index more words from thesaurus (#4570)

This commit is contained in:
Frédéric Péters 2014-03-25 16:41:13 +01:00
parent 83c77feaf8
commit bba9c15468
1 changed files with 4 additions and 1 deletions

View File

@ -9,6 +9,8 @@ from zope.schema.interfaces import IVocabularyFactory
from pfwbged.folder import IFolder
from collective.dms.basecontent.dmsdocument import IDmsDocument
from plone import api
from .behaviors import IPfwbDocument
@ -44,10 +46,11 @@ def document_dynamic_searchable_text_indexer(obj):
if hasattr(obj, 'keywords') and obj.keywords:
factory = getUtility(IVocabularyFactory, 'dms.thesaurus.simple')
thesaurus = api.portal.get()['thesaurus']
vocabulary = factory(obj)
for keyword in obj.keywords:
try:
indexed_elements.append(vocabulary.getTerm(keyword).title)
indexed_elements.append(thesaurus[keyword].get_words_for_indexation())
except LookupError:
continue