I had the same problem, only my code was in dtml not tal.... here is the solution in case you decide you'd like to implement it in dtml.... this does a correct 'or' search on multiple indexes... <dtml-in expr="Catalog(notes_idx=term) + Catalog(description_idx=term)"> ... do what you want with the results </dtml-in> Cheers Ruth ----- Original Message ----- From: "Paul Smith" <paul.smith@bristol.ac.uk> To: <zope@zope.org> Sent: Tuesday, October 28, 2003 2:44 PM Subject: [Zope] Searching across multiple indexes
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: here.Catalog({'description_idx':term,'notes_idx':term});">
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:
http://www.zope.org/Members/k/ZCatalog_searchResults_note
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
--------------------------------------------------------------------------
Paul.Smith@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/ | http://www.vts.rdn.ac.uk/ 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
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )