[ZCM] [ZC] 195/ 1 Request "Catalog.searchResults - OR search bug"

Collector: Zope Bugs and Patches ... zope-coders@zope.org
Tue, 05 Feb 2002 13:07:30 -0500


Issue #195 Update (Request) "Catalog.searchResults - OR search bug"
 Status Pending, Zope/bug medium
To followup, visit:
  http://collector.zope.org/Zope/195

==============================================================
= Request - Entry #1 by Anonymous User on Feb 5, 2002 1:07 pm

I have encountered a problem with OR searches in zcatalog.

 If the first search set is empty then the final search
 set is also empty, even if the second search set has
 valid results.

 Example:

 <dtml-in "Catalog.searchResults({'fieldindexA' : 'goodvalue'}, {'fieldindexA' : 'goodvalue'})">
              /* returns a valid result set*/

 <dtml-in "Catalog.searchResults({'fieldindexA' : 'badvalue'}, {'fieldindexA' : 'badvalue'})">
             /* returns a valid result set (empty set)*/

 <dtml-in "Catalog.searchResults({'fieldindexA' : 'goodvalue'}, {'fieldindexA' : 'badvalue'})">
            /* returns a valid result set*/

 <dtml-in "Catalog.searchResults({'fieldindex' : 'badvalue'}, {'fieldindex' : 'goodvalue'})">
           /* returns INVALID result set (empty set)*/

 where:
    goodvalue - exists in fieldindex
    badvalue - does not exist in fieldindex


 The ultimate search logic I want to use is:

 ('owner_id' = 'owner') AND ('class1' = 'userdata' OR 'class2' = 'userdata')

 Where:
  owner_id, class1, class2 are zcatalog indexes
  owner, userdata are user-supplied (via html form) data

 When I try:

 <dtml-in Catalog.searchResults({'owner_id' : 'owner', 'class1': 'userdata'}, {'owner_id' : 'owner', 'class2' : 'userdata'})">

 I get an empty result set if 'class1' does not contain 'userdata', even
 if 'class2' does contain 'userdata' ('owner_id' matches 'owner' in both cases)

 Is this a bug, or am I doing something wrong?
 (I tried posting a message on the zope bulletin board on
 Yahoo, but didn't get a response).

 Thanks,

 Jonathan Hobbs

==============================================================