summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2014-03-25 15:42:05 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2014-03-25 15:42:05 (GMT)
commitca14ea0a5cea9edc80896080dd2075771cea0954 (patch)
tree0cca688ea5589f4e5781c4be6c2e212dec28410f
parentdbf6acb98f79c461cc9b07bbf6d0df5af46da727 (diff)
downloadcollective.dms.thesaurus-ca14ea0a5cea9edc80896080dd2075771cea0954.zip
collective.dms.thesaurus-ca14ea0a5cea9edc80896080dd2075771cea0954.tar.gz
collective.dms.thesaurus-ca14ea0a5cea9edc80896080dd2075771cea0954.tar.bz2
index more words from thesaurus (#4570)
-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):
""" """