summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/collective/dms/thesaurus/dmskeyword.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/collective/dms/thesaurus/dmskeyword.py b/src/collective/dms/thesaurus/dmskeyword.py
index 2e490f2..6b72217 100644
--- a/src/collective/dms/thesaurus/dmskeyword.py
+++ b/src/collective/dms/thesaurus/dmskeyword.py
@@ -61,6 +61,22 @@ class DmsKeyword(Item):
""" """
implements(IDmsKeyword)
+ def get_words_for_indexation(self, limit=5):
+ thesaurus = aq_parent(self)
+ words = []
+ words.append(self.title)
+ for word in self.equivs or []:
+ words.append(word)
+ if limit > 0:
+ for broader_keyword in self.broader or []:
+ try:
+ keyword = thesaurus[broader_keyword]
+ except KeyError:
+ continue
+ words.append(keyword.get_words_for_indexation(limit=limit-1))
+ return ' '.join(words)
+
+
class DmsKeywordSchemaPolicy(DexteritySchemaPolicy):
""" """