[Zope-Checkins] SVN: Zope/branches/Zope-2_8-branch/ Made 'and'
operator for KeywordIndexes actually restrict results as expected.
Tres Seaver
tseaver at palladion.com
Fri May 27 11:54:56 EDT 2005
Log message for revision 30532:
Made 'and' operator for KeywordIndexes actually restrict results as expected.
Collector #889 -- thanks to 'aroda' for the patch!
Changed:
U Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
U Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py
U Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/common/UnIndex.py
-=-
Modified: Zope/branches/Zope-2_8-branch/doc/CHANGES.txt
===================================================================
--- Zope/branches/Zope-2_8-branch/doc/CHANGES.txt 2005-05-27 14:58:57 UTC (rev 30531)
+++ Zope/branches/Zope-2_8-branch/doc/CHANGES.txt 2005-05-27 15:54:26 UTC (rev 30532)
@@ -22,7 +22,13 @@
- Collector #1233: port ZOPE_CONFIG patch from Zope 2.7 to Zope 2.8
+ After Zope 2.8.0 b2
+ Bugs Fixed
+
+ - Collector #889: made 'and' operator for KeywordIndexes actually
+ restrict results as expected (thanks to 'aroda' for the patch!).
+
Zope 2.8.0 b2 (2005/05/22)
Features added
Modified: Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py 2005-05-27 14:58:57 UTC (rev 30531)
+++ Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py 2005-05-27 15:54:26 UTC (rev 30532)
@@ -221,6 +221,33 @@
finally:
self._ignore_log_errors()
+ def testCollectorIssue889(self) :
+ # Test that collector issue 889 is solved
+ values = self._values
+ nonexistent = 'foo-bar-baz'
+ self._populateIndex()
+ # make sure key is not indexed
+ result = self._index._index.get(nonexistent, self._marker)
+ assert result is self._marker
+ # patched _apply_index now works as expected
+ record = {'foo' : { 'query' : [nonexistent]
+ , 'operator' : 'and'}
+ }
+ self._checkApply(record, [])
+ record = {'foo' : { 'query' : [nonexistent, 'a']
+ , 'operator' : 'and'}
+ }
+ # and does not break anything
+ self._checkApply(record, [])
+ record = {'foo' : { 'query' : ['d']
+ , 'operator' : 'and'}
+ }
+ self._checkApply(record, values[4:5])
+ record = {'foo' : { 'query' : ['a', 'e']
+ , 'operator' : 'and'}
+ }
+ self._checkApply(record, values[5:7])
+
def test_suite():
suite = unittest.TestSuite()
suite.addTest( unittest.makeSuite( TestKeywordIndex ) )
Modified: Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/common/UnIndex.py
===================================================================
--- Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/common/UnIndex.py 2005-05-27 14:58:57 UTC (rev 30531)
+++ Zope/branches/Zope-2_8-branch/lib/python/Products/PluginIndexes/common/UnIndex.py 2005-05-27 15:54:26 UTC (rev 30532)
@@ -363,10 +363,11 @@
else: # not a range search
for key in record.keys:
set=index.get(key, None)
- if set is not None:
- if isinstance(set, int):
- set = IISet((set,))
- r = set_func(r, set)
+ if set is None:
+ set = IISet(())
+ elif isinstance(set, int):
+ set = IISet((set,))
+ r = set_func(r, set)
if isinstance(r, int): r=IISet((r,))
if r is None:
More information about the Zope-Checkins
mailing list