Beispiel #1
0
 def get_search_data(self, request=None):
     """
     Provides an index for use with Haystack, or, for populating
     Event.translations.search_data.
     """
     if not self.pk:
         return ''
     language = self.title.language
     if language is None:
         language = get_current_language()
     if request is None:
         request = get_request(language=language)
     text_bits = []
     placeholder = self.get_placeholder()
     if placeholder:
         plugins = placeholder.cmsplugin_set.filter(language=language)
         for base_plugin in plugins:
             try:
                 plugin_text_content = ' '.join(
                     get_plugin_index_data(base_plugin, request))
             except:
                 plugin_text_content = ''
             text_bits.append(plugin_text_content)
     text_bits.append(self.title.title)
     text_bits.append(self.title.meta_description or '')
     return ' '.join(text_bits)
Beispiel #2
0
 def get_search_data(self, language=None, request=None):
     """
     Provides an index for use with Haystack, or, for populating
     Service.translations.search_data.
     """
     if not self.pk:
         return ''
     if language is None:
         language = get_current_language()
     if request is None:
         request = get_request(language=language)
     title = self.safe_translation_getter('title', '')
     description = self.safe_translation_getter('lead_in', '')
     text_bits = [title, strip_tags(description)]
     if ADD_CATEGORIES_TO_SEARCH_DATA:
         for category in self.categories.all():
             text_bits.append(
                 force_unicode(category.safe_translation_getter('name')))
     if self.content:
         plugins = self.content.cmsplugin_set.filter(language=language)
         for base_plugin in plugins:
             plugin_text_content = ' '.join(
                 get_plugin_index_data(base_plugin, request))
             text_bits.append(plugin_text_content)
     return ' '.join(text_bits)
 def get_search_data(self, language=None, request=None):
     """
     Provides an index for use with Haystack, or, for populating
     Article.translations.search_data.
     """
     if not self.pk:
         return ''
     if language is None:
         language = get_current_language()
     if request is None:
         request = get_request(language=language)
     description = self.safe_translation_getter('lead_in', '')
     text_bits = [strip_tags(description)]
     for category in self.categories.all():
         text_bits.append(
             force_text(category.safe_translation_getter('name')))
     for tag in self.article_tags.all():
         text_bits.append(force_text(tag.name))
     if self.content:
         plugins = self.content.cmsplugin_set.filter(language=language)
         for base_plugin in plugins:
             plugin_text_content = ' '.join(
                 get_plugin_index_data(base_plugin, request))
             text_bits.append(plugin_text_content)
     return ' '.join(text_bits)
Beispiel #4
0
 def get_search_data(self, language=None, request=None):
     """
     Provides an index for use with Haystack, or, for populating
     Event.translations.search_data.
     """
     if not self.pk:
         return ''
     if language is None:
         language = get_current_language()
     if request is None:
         request = get_request(language=language)
     text_bits = [self.first_name]
     text_bits.append(self.last_name)
     text_bits.append(self.safe_translation_getter('function', ''))
     description = self.safe_translation_getter('description', '')
     text_bits.append(strip_tags(description))
     for category in self.categories.all():
         text_bits.append(
             force_unicode(category.safe_translation_getter('name')))
     for service in self.services.all():
         text_bits.append(
             force_unicode(service.safe_translation_getter('title')))
     if self.content:
         plugins = self.content.cmsplugin_set.filter(language=language)
         for base_plugin in plugins:
             plugin_text_content = ' '.join(
                 get_plugin_index_data(base_plugin, request))
             text_bits.append(plugin_text_content)
     return ' '.join(text_bits)