From 6b8545754c02517a9bd6637d994c2ae04f299a96 Mon Sep 17 00:00:00 2001 From: helmutm Date: Sun, 11 Apr 2010 15:32:08 +0000 Subject: [PATCH] provide general-purpose 'loops_keywords' index git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3810 fd906abe-77d9-0310-91a1-e0d9ade77398 --- concept.py | 3 +++ expert/query.py | 13 +++++++++++++ 2 files changed, 16 insertions(+) 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