[ZCM] [ZC] 195/ 3 Reject "Catalog.searchResults - OR search bug"
Collector: Zope Bugs and Patches ...
zope-coders@zope.org
Mon, 11 Feb 2002 09:32:24 -0500
Issue #195 Update (Reject) "Catalog.searchResults - OR search bug"
Status Rejected, Zope/bug medium
To followup, visit:
http://collector.zope.org/Zope/195
==============================================================
= Reject - Entry #3 by ajung on Feb 11, 2002 9:32 am
Status: Accepted => Rejected
I reject this issue because:
- AND search makes no sense on FieldIndexes
- OR search works. You have to use the following syntax:
catalog.searchResults({'fieldindex': {'query': [arg1,arg2,...} })
- aj
________________________________________
= Accept - Entry #2 by ajung on Feb 5, 2002 1:35 pm
Status: Pending => Accepted
Supporters added: ajung
I can reject and accept this issue :-)
reject: your queries perform an AND search. The API
documentation of the ZCatalog show how to perform OR
searches by combining two queries using '+'
accept:
<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)*/
should return in both cases an empty result set for this
AND search. I can reproduce this problem there is not fix
available yet.
- aj
________________________________________
= 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
==============================================================