[ZCM] [ZC] 889/ 6 Comment "Keyword index query error"

Collector: Zope Bugs, Features, and Patches ... zope-coders-admin at zope.org
Tue May 31 04:14:28 EDT 2005


Issue #889 Update (Comment) "Keyword index query error"
 Status Resolved, Catalog/bug medium
To followup, visit:
  http://www.zope.org/Collectors/Zope/889

==============================================================
= Comment - Entry #6 by suvit on May 31, 2005 4:14 am

Note: check for int type is redundant.
>>> from BTrees.IIBTree import IISet, union, intersection
>>> union(None,None)
>>> union(None,5)
5
>>> union(IISet(),5)
IISet([5])
>>> intersection(IISet([5,6]),6)
IISet([6])

In other words not range search may be written in 2 lines.

for key in record.keys:
  r = set_func( r, index.get(key, IISet()) )

________________________________________
= Resolve - Entry #5 by tseaver on May 27, 2005 12:02 pm

 Status: Accepted => Resolved

Patch applied for the 2.7 branch:

  http://cvs.zope.org/Zope/lib/python/Products/PluginIndexes/common/Attic/UnIndex.py.diff?r1=1.20.2.6&r2=1.20.2.7

  http://cvs.zope.org/Zope/lib/python/Products/PluginIndexes/KeywordIndex/tests/Attic/testKeywordIndex.py.diff?r1=1.6.12.1&r2=1.6.12.2


the 2.8 branch:

  http://svn.zope.org/?rev=30532&view=rev

and the trunk:

  http://svn.zope.org/?rev=30533&view=rev
________________________________________
= Comment - Entry #4 by tseaver on May 27, 2005 8:56 am

> BTW, a small style niggle:  please prefer 'self.failUnless' or
> 'self.assert_' to a bare 'assert' in unit tests.

Ooops!  My bad -- I just looked at the test module you were
patching:  it is full of bare 'assert' usage.  I won't be cleaning
it up, at least on the 2.7 line.
________________________________________
= Accept - Entry #3 by tseaver on May 27, 2005 8:39 am

 Status: Pending => Accepted

 Supporters added: tseaver

Thanks for the patch.  I will be checking it in for the 2.7 branch,
the 2.8 branch, and the SVN HEAD.

BTW, a small style niggle:  please prefer 'self.failUnless' or
'self.assert_' to a bare 'assert' in unit tests.
________________________________________
= Comment - Entry #2 by aroda on May 27, 2005 4:41 am


Uploaded:  "patch_889.txt"
 - http://www.zope.org/Collectors/Zope/889/patch_889.txt/view
Attached is a patch that solves the bug and adds a new test to the test suite.

________________________________________
= Request - Entry #1 by tejay on Apr 23, 2003 8:04 pm

Submiting a query such as: {'query' : [key1,key2], operator='and'} from a python product doesn't produce the expected result when no objects are indexed with either key1 or key2.  You would expect no objects to be found, but instead if either key1 or key2 returns no matches, then that is ignored and the matches for the other key ar returned.  

PluginIndexes/common/UnIndex.py::_apply_index() is the culprit I beleive.  It does a query for the index on each key seperately, and if the result is NOT empty, it intersects the result (went he operator is 'and').  

Instead it should return an empty set if any index lookup is empty.
==============================================================



More information about the Zope-Collector-Monitor mailing list