helper function to build the recursive list of broader keywords (#4570)
This commit is contained in:
parent
85f0820005
commit
101c84d801
|
@ -76,6 +76,16 @@ class DmsKeyword(Item):
|
|||
words.append(keyword.get_words_for_indexation(limit=limit-1))
|
||||
return ' '.join(words)
|
||||
|
||||
def get_keyword_tree(self, limit=5):
|
||||
thesaurus = aq_parent(self)
|
||||
l = [self.id]
|
||||
for broader_keyword in self.broader or []:
|
||||
try:
|
||||
keyword = thesaurus[broader_keyword]
|
||||
except KeyError:
|
||||
continue
|
||||
l.extend(keyword.get_keyword_tree(limit=limit-1))
|
||||
return l
|
||||
|
||||
|
||||
class DmsKeywordSchemaPolicy(DexteritySchemaPolicy):
|
||||
|
|
Reference in New Issue