Searching catalog via substring
Hi, 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". Can anyone point me to the right direction? Many thanks in advance. Lars Reineke
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
participants (2)
-
Dieter Maurer -
Reineke