add indexation of keywords (#4480)

This commit is contained in:
Frédéric Péters 2014-03-17 11:41:38 +01:00
parent 82188916d6
commit 4a746d1856
1 changed files with 13 additions and 0 deletions

View File

@ -6,6 +6,9 @@ from plone.indexer import indexer
from zope.component import getUtility
from zope.schema.interfaces import IVocabularyFactory
from pfwbged.folder import IFolder
from collective.dms.basecontent.dmsdocument import IDmsDocument
from .behaviors import IPfwbDocument
@ -49,3 +52,13 @@ def document_dynamic_searchable_text_indexer(obj):
grok.global_adapter(document_dynamic_searchable_text_indexer,
name='SearchableText')
@indexer(IDmsDocument)
def thesaurus_keywords(obj, **kw):
if not hasattr(obj, 'keywords'):
return []
if not obj.keywords:
return []
return [x for x in obj.keywords if x]
grok.global_adapter(thesaurus_keywords, name='thesaurus_keywords')