diff --git a/concept.py b/concept.py index 9c890e1..1897433 100644 --- a/concept.py +++ b/concept.py @@ -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 diff --git a/expert/query.py b/expert/query.py index 3519deb..ab9f2b6 100644 --- a/expert/query.py +++ b/expert/query.py @@ -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