provide general-purpose 'loops_keywords' index

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3810 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2010-04-11 15:32:08 +00:00
parent 2d7ebd0288
commit 6b8545754c
2 changed files with 16 additions and 0 deletions

View file

@ -461,6 +461,9 @@ class IndexAttributes(object):
return getName(self.context)
return id
def keywords(self):
if self.adaptedIndexAttributes is not None:
return self.adaptedIndexAttributes.keywords()
# events

View file

@ -43,6 +43,7 @@ textIndex = ('', 'loops_text')
typeIndex = ('', 'loops_type')
identifierIndex = ('', 'loops_identifier')
stateIndex = ('', 'loops_state')
keywordsIndex = ('', 'loops_keywords')
# standard text/field/keyword index queries
@ -73,6 +74,18 @@ def State(statesDefinition, value):
value = [value]
return AnyOf(stateIndex, [':'.join((statesDefinition, v)) for v in value])
@implementer(IQuery)
def KeywordsAllOff(statesDefinition, value):
if not isinstance(value, (list, tuple)):
value = [value]
return AllOf(keywordsIndex, [':'.join((statesDefinition, v)) for v in value])
@implementer(IQuery)
def KeywordsAnyOff(statesDefinition, value):
if not isinstance(value, (list, tuple)):
value = [value]
return AnyOf(keywordsIndex, [':'.join((statesDefinition, v)) for v in value])
# concept map queries