Log message for revision 30533:
  Forward port fix for Collector #889 from 2.8 branch.

Changed:
  U   
Zope/trunk/lib/python/Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py
  U   Zope/trunk/lib/python/Products/PluginIndexes/common/UnIndex.py

-=-
Modified: 
Zope/trunk/lib/python/Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py
===================================================================
--- 
Zope/trunk/lib/python/Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py
 2005-05-27 15:54:26 UTC (rev 30532)
+++ 
Zope/trunk/lib/python/Products/PluginIndexes/KeywordIndex/tests/testKeywordIndex.py
 2005-05-27 15:58:44 UTC (rev 30533)
@@ -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/trunk/lib/python/Products/PluginIndexes/common/UnIndex.py
===================================================================
--- Zope/trunk/lib/python/Products/PluginIndexes/common/UnIndex.py      
2005-05-27 15:54:26 UTC (rev 30532)
+++ Zope/trunk/lib/python/Products/PluginIndexes/common/UnIndex.py      
2005-05-27 15:58:44 UTC (rev 30533)
@@ -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:

_______________________________________________
Zope-Checkins maillist  -  Zope-Checkins@zope.org
http://mail.zope.org/mailman/listinfo/zope-checkins

Reply via email to