[Zope] Indexing files

Tino Wildenhain tino at wildenhain.de
Sat Jan 21 09:50:10 EST 2006


Jens Vagelpohl schrieb:
> 
> On 21 Jan 2006, at 13:02, Sune Christiansen wrote:
> 
>> Hei All.
>>
>> I have the following problem:
>> I am building up a ZCatalog and indexing my DTML methods. I use the 
>> index
>> type ZCTextIndex and the object function PrincipiaSearchSource. It  works
>> fine.
>> But when I try to index my Files (type File) with index type  ZCTextIndex
>> and the object function SearchableText it finds no words and the 
>> index is
>> empty. Am I using the wrong object function?
> 
> 
> Zope File objects do not support indexing their textual content. You 
> will need to implement your own text retrieval or use some of the  other
> indices out there like Andreas Jung's  TextIndexNG which come  with
> suitable modules that can pull text out of various file formats.
> 

Newer Zopes have file-objects indexable via PrincipiaSearchSource
if their content-type is text/*

OFS/Image.py, 423ff:

    def PrincipiaSearchSource(self):
        """ Allow file objects to be searched.
        """
        if self.content_type.startswith('text/'):
            return str(self.data)
        return ''


HTH
tino


More information about the Zope mailing list