[Zope] Searching catalog via substring

Dieter Maurer dieter@handshake.de
Mon, 15 Jul 2002 19:58:17 +0200


Reineke writes:
 > I have got a ZCatalog, named "catalog" and 2 automatically-mady-by-zope-DTML-methods "search" and "report".
 > The "search"-form submits the variable "title" to "report" which <dtml-in>s over the catalog.
 > 
 > For example:
 > http://server.domain.com/report?title=something
 > 
 > So far, so good. When the title contains "something" as a word, the object is found.
 > 
 > What I would like to do is automatically searching with "*" concatenated to the beginning and to the end of the searchstring, so the object "something" is found when the user enters only "some" or "thing".

Use a "globbing vocabulary". Then "*" and "?" are recognized as wildcards
with the usual interpretation. Of course, there is a caveat.
Textindexes support a quite complex query language including boolean
operators, phrase searches and near searches. When the user types
in such a complex query automatically pre- and appending '*' will
give unexpected results.


Dieter