[Zope-dev] Catalog class--does it support boolean queries?

Casey Duncan cduncan@kaivo.com
Fri, 15 Dec 2000 09:26:13 -0700


Chris Withers wrote:
> 
> Marc Conley wrote:
> >
> > boolean queries seem not to work. Should boolean queries work using Catalog
> > or is it
> > necessary to use ZCatalog instead to get that functionality?
> 
> I'm not sure boolean queries work in either. If they do, anyone know
> where their syntax is documented?
> 
> cheers,
> 
> Chris

>From digging around in the code, here is the general text index query
syntax (if you can call it that):

"one two three" and "one or two or three" are equivilant, multiple words
are "orified" by default. Hits are scored according to the number of
words matched, so by default, objects matching all words will be first
in the results. 

"one and two and three" and ['one','two','three'] will return only
objects containing all three words.

"one and not two" ('andnot' also works) works as advertised.

Wildcard characters "*" and "?" can be used to match multiple word
forms. e.g. a query for "great*" would match "great", "greats",
"greatest", "greatly", etc.

There is also a mentioned support for "near" searching in the code using
a '...' operator, although in practice this does not work 8^(. It seems
as though all non-aphanumerics are stripped from the query somewhere.
IMHO this should probably just use the word "near" as an operator
anyway.

For those interested, the indexing/searching code lives in {Zope
Dir}/lib/python/SearchIndex.

In doing some more digging in UnTextIndex.py there I do see support for
parens and quoted phases, although in practice they do not work. If I
find time I will delve into this further.
-- 
| Casey Duncan
| Kaivo, Inc.
| cduncan@kaivo.com
`------------------>