Ejemplo n.º 1
0
 def prepare(self, object):
     self.prepared_data = super(AuthorityProfileIndex, self).prepare(object)
     # Clean the text.
     if self.prepared_data['text']:
         self.prepared_data['text']= downcode(clean_text_for_search(
             self.prepared_data['text']))
     if self.prepared_data['report_text'] is None:
         self.prepared_data['report_text']= ''
     return self.prepared_data
Ejemplo n.º 2
0
    def prepare(self, object):
        self.prepared_data = super(PIARequestIndex, self).prepare(object)

        # Extract all the messages from the PIAThread
        # and append them to the end of `text`.
        for msg in object.thread.filter(
                created__lte=self._till_now()).order_by('created'):
            self.prepared_data['text'] += msg.body

        # For reporting purposes storing a duplicate of the thread,
        # cleaned, but not downcoded.
        self.prepared_data['report_text']= clean_text_for_search(
            self.prepared_data['text'])

        # Clean and downcode text for index.
        self.prepared_data['text']= downcode(self.prepared_data['report_text'])

        return self.prepared_data