[Zope-dev] How do index the contents of a File?

Evan Simpson evan@tokenexchange.com
Fri, 7 Jan 2000 12:50:26 -0600


From: Carlos Henrique Bauer <bauer@atlas.unisinos.br>
> I created a ZCatalog to index all the contents of a site. To index the
contents
> of the documents I added a 'raw' text index to the catalog, but it seems
to be
> working just with DTML Documents. Do I need to add another index to the
catalog
> to make it index File documents or is it a ZCatalog bug?

File objects are not 'documents', although they may of course contain files
which you consider to be documents.  Since File objects can contain
*anything*, including binary executables or images, they don't define
'contents' for ZCatalog purposes.

What you might want to do is create a sub-ZClass of File dedicated to
storing your document files, and define a PrincipiaSearchSource method which
returns the contents of the object.  You could even pre-process the contents
in this method if you wanted to strip off headers or formatting or any other
bits you don't really want in your full-text search.

Cheers,

Evan @ 4-am