From one Paul to another Paul, To achieve boolean 'or' searches in ZCatalog, try something like this: 1. make a python script named description_notes, with the following one line that concatenates your description and notes attributes. place this script down low in your zope so that it can be acquired from your catalog and objects to be indexed. no parameters are passed, only the context is needed. return context.description + '/n' + context.notes 2. create a new index in your ZCatalog called 'description_notes'. Thanks to acquisition, ZCatalog will find the description_notes script and run it for each new object being cataloged. Now the index will capture any term that is in the concatenated description and notes field, which is perfectly equivalent to the boolean "or". It works for me. Almost needless to say, don't bother keeping this combined index term in your metadata :-) =Paul At 01:44 PM 10/28/2003 +0000, Paul Smith wrote:
<snip> 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