[Zope] Searching across multiple indexes

Paul Smith paul.smith at bristol.ac.uk
Tue Oct 28 08:44:29 EST 2003

I've been looking through various documents which suggest that searching 
across multiple indexed in a ZCatalog is possible, and it seems to be so, 
but I've only had partial success. I'm hoping someone can shed some light 
on why I can't get the following to work properly!

(Using Zope 2.6.2)

I have a catalog which contains two indexed: description_idx; notes_idx

Both indexes can be searched in isolation; the lexicon shows content, and 
so there appears to be nothing wrong with the indexes.

The following code works OK (ie it returns objects as I would expect), 
doing an 'and' search of the two indexes - with the search term appearing 
in both indexes:

<tal:block tal:define="term request/form/search_term;
                     results  python: 

However, if I change this code to read:

results  python: here.Catalog({'description_idx':term},{'notes_idx':term});

which I have read should produce an 'or' search, I only get results where 
the first index (description_idx) matches. If I reverse the order, thus:

results  python: here.Catalog({'notes_idx':term},{'description_idx':term});

I get matches for the first index (notes_idx) but not the second 
(description_idx) as before.

I took this syntax from a document at:


Can anyone tell me if this is supposed to work, and if so, why it's not; or 
if it's not supposed to work, how I can do an 'or' search in similar fashion.

Thanks in advance,



Paul.Smith at bristol.ac.uk
Senior Technical Officer (Web Development),
Internet Development Group | RDN Virtual Training Suite
<http://www.ilrt.bris.ac.uk/id/>http://www.ilrt.bris.ac.uk/id/ | 
Institute for Learning and Research Technology,
University of Bristol, 8-10 Berkeley Square,
Bristol BS8 1HH, UK Tel: +44 (0)117 928 7192, Fax: +44 (0)117 928 7112

More information about the Zope mailing list