Esempio n. 1
0
 def indexableContent(self, fields):
     """Returns index data for TextIndexNG3.
     """
     icc = IndexContentCollector()
     if 'definition' in fields:
         icc.addContent('definition', self.getDefinition(mimetype='text/plain').decode('utf8'), self.Language())
     if 'title' in fields:
         icc.addContent('title', self.Title().decode('utf8'), self.Language())
     return icc
Esempio n. 2
0
    def indexableContent(self, fields):
        icc = IndexContentCollector()

        for field in fields:
            method = "index" + field
            if hasattr(self, method):
                getattr(self, method)(icc)

        if not icc.getFields():
            return None

        return icc
Esempio n. 3
0
    def indexableContent(self, fields):
        icc=IndexContentCollector()

        for field in fields:
            method="index"+field
            if hasattr(self, method):
                getattr(self, method)(icc)

        if not icc.getFields():
            return None

        return icc
Esempio n. 4
0
    def indexableContent(self, fields):

        dirname = os.path.dirname(__file__)
        filename = os.path.join(dirname, self.filename)
        if 'SearchableText' in fields:
            icc = ICC()
            icc.addContent('SearchableText', u'Die Vögel', 'de')
            icc.addBinary('SearchableText',
                          open(filename, 'rb').read(), 'application/pdf',
                          'iso-8859-15', None)
            return icc

        return None
Esempio n. 5
0
    def indexableContent(self, fields):

        dirname = os.path.dirname(__file__)
        filename = os.path.join(dirname, self.filename)
        if 'SearchableText' in fields:
            icc = ICC()
            icc.addContent('SearchableText', u'Die Vögel', 'de')
            icc.addBinary('SearchableText',
                          open(filename, 'rb').read(),
                          'application/pdf',
                          'iso-8859-15',
                          None)
            return icc

        return None
Esempio n. 6
0
def getAttachmentsContent(content):
    extension = IAttachmentsExtension(content, None)
    if extension is None:
        return u''

    values = []
    collector = IndexContentCollector()
    for item in extension:
        item = extension[item]
        try:
            collector.addBinary(
                item.__name__, item.data.data,
                item.data.mimeType, raiseException=False, encoding='utf-8')
        except AttributeError:
            continue
        except ConversionError:
            continue

    return (u'\n'.join([y['content'] for x in collector.getFields()
                        for y in collector.getFieldData(x)])).strip()
Esempio n. 7
0
 def indexableContent(self, fields):
     icc = ICC()
     for f in fields:
         if self.__dict__.has_key(f):
             icc.addContent(f, self.__dict__[f], self.language)
     return icc
Esempio n. 8
0
 def indexableContent(self, fields):
     icc = ICC()
     icc.addContent('SearchableText', u'i am so stupid', 'en')
     return icc
Esempio n. 9
0
 def indexableContent(self, fields):
     icc = ICC()
     for f in fields:
         if self.__dict__.has_key(f):
             icc.addContent(f, self.__dict__[f], self.language)
     return icc
Esempio n. 10
0
 def indexableContent(self, fields):
     icc = ICC()
     icc.addContent('SearchableText', u'i am so stupid', 'en')
     return icc