[Zope] Help with Search in Zope

Oleg Broytmann Oleg Broytmann <phd@phd.fep.ru>
Tue, 10 Apr 2001 18:44:28 +0400 (MSD)


On Tue, 10 Apr 2001, Chris McDonough wrote:
> >    There are so many questions and problems and deficiencies about
> > ZCatalog. Think for example I want to index a site on
> > bobobase_modification_time and search for date ranges. Impossible!
> ZCatalog
> > does not have ranges.
>
> Yes it does.  See the section titled "Searching Field Indexes" in the Zope
> Book.

   Aha. Nice!

> > index. What if I want to search for
> >    "title LIKE '%ZOPE% OR body LIKE '%python%'"? Alas!
>
> You currently need to union and/or intersect the result sets manually.  It
> *is* hard, yes.  ;-)

   And I'll have duplicates :(

> >    A crazy idea sprang into my mind. What if I, the site programmer, could
> > provide a callback function, and ZCatalog will call the function for every
> > index? Then I can code such simple or complex search as I need.
> >
> > Let the function return 1 for objects that correspond the serach criteria,
> > 0 for failed objects, and raise StopSearch exception if it need to stop
> > search immediatly.
>
> THis is a pretty cool idea... except I think that it might be better to just
> use the callback to aggregate search results in interesting ways on a
> per-index basis.  For instance, if you specify three indexes in a query and
> specify a callback, the callback can do unions or intersections on the
> result sets returned from each index manually...

   May be. These ideas cretainly deserve some thoughts.

Oleg.
----
     Oleg Broytmann     http://www.zope.org/Members/phd/     phd@phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.