[Zope] Howto search multiple fields of ZCatalog

Dieter Maurer dieter@handshake.de
Fri, 22 Nov 2002 19:54:04 +0100


Ralph vd Houdt writes:
 > I'm trying to create a search in a ZCatalog in wich I can give a single
 > search string, for example "this AND that" that will search in 2 or more
 > combined fields.
 > 
 > If both (or more) values are available in the combined text of the fields
 > than there should be a match, for example when "this" is in the title and
 > "that" is in the description the object has to be in the result set.
 > 
 > Is there any solution to this problem?
You make a combined index covering all text fields you want to search
in. You do this by defining an index (say "combined_index")
and a method/script of the same name.
The script, applied to an object, should return whatever you want
to index in this index to the object.

More details: Zope book, ZCatalog section.


Dieter