Commit ed5cd1cf authored by Tres Seaver's avatar Tres Seaver

Forward port fix for Collector #889 from 2.8 branch.

parent 95162e4a
......@@ -221,6 +221,33 @@ class TestKeywordIndex( unittest.TestCase ):
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 ) )
......
......@@ -363,8 +363,9 @@ class UnIndex(SimpleItem):
else: # not a range search
for key in record.keys:
set=index.get(key, None)
if set is not None:
if isinstance(set, int):
if set is None:
set = IISet(())
elif isinstance(set, int):
set = IISet((set,))
r = set_func(r, set)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment