[Zope-CMF] KeywordIndex search with operator 'and' returns all results when only one keyword matches

Richard Ettema richard.ettema@yoursolutions.com
Thu, 26 Jun 2003 19:30:12 +0100


Hi,
When I search a CMF site catalog with the dtml shown below (searching with
'review_state' (fieldindex) and 'food' (keywordIndex) ) the following
occurs:

 -if there are SOME cataloged items with both 'oranges' and 'apples',
published items cataloged with a 'food' index matching 'oranges' AND
'apples' are returned as expected.

 -if there are NO cataloged items with both 'oranges' and 'apples',
published items cataloged with a 'food' index matching 'oranges' OR 'apples'
are returned. No items should be returned by my reckoning?

I have searched around for anyone with this situation, but have not found
anything. Thanks for any ideas or pointers.
I did see some mention of the operator being passed as "operator='and'"
rather than in a dict, but that didn't make any sense to me.

###

<dtml-let search_dict="{'review_state':'published','food':
{'query':['oranges', 'apples'], 'operator':'and'} }"
          results="portal_catalog.searchResults( search_dict )">

     <dtml-in results>
      <dtml-var Title>
     </dtml-in>
    (<dtml-var expr="_.len(results)" thousands_commas>)</div>

</dtml-let>

###

Running:
-zope 2.5.1
-cmf 1.3
-python 2.1.3

Thanks for your help with this.

Richard




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.490 / Virus Database: 289 - Release Date: 16/06/2003