make sure keyword queries return an IFSet so that corresponding union and intersection functions may be used in complex queries
git-svn-id: svn://svn.cy55.de/Zope3/src/cybertools/trunk@2573 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
43c0b9c4c7
commit
01b1b5a644
1 changed files with 10 additions and 5 deletions
|
@ -26,7 +26,8 @@ $Id$
|
|||
"""
|
||||
|
||||
from BTrees.IFBTree import weightedIntersection, weightedUnion
|
||||
from BTrees.IFBTree import difference, IFBTree, IFBucket
|
||||
from BTrees.IFBTree import difference, IFBTree, IFBucket, IFSet
|
||||
from BTrees.IIBTree import IISet, union
|
||||
from zope.app.intid.interfaces import IIntIds
|
||||
from zope.app.catalog.catalog import ResultSet
|
||||
from zope.app.catalog.field import IFieldIndex
|
||||
|
@ -248,13 +249,17 @@ class KeywordTerm(IndexTerm):
|
|||
class AnyOf(KeywordTerm):
|
||||
|
||||
def apply(self):
|
||||
index = self.getIndex()
|
||||
return index.search(self.values, 'or')
|
||||
result = self.getIndex().search(self.values, 'or')
|
||||
if isinstance(result, IFSet):
|
||||
return result
|
||||
return IFSet(result)
|
||||
|
||||
|
||||
class AllOf(KeywordTerm):
|
||||
|
||||
def apply(self):
|
||||
index = self.getIndex()
|
||||
return index.search(self.values, 'and')
|
||||
result = self.getIndex().search(self.values, 'and')
|
||||
if isinstance(result, IFSet):
|
||||
return result
|
||||
return IFSet(result)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue