also index title and contents of mails to SearchableText
This commit is contained in:
parent
d61e566514
commit
7af1ce0df2
|
@ -13,6 +13,8 @@ from zope import schema
|
|||
from zope.component import getAdapters, getMultiAdapter
|
||||
from zope.interface import alsoProvides
|
||||
|
||||
import themis.search.indexer
|
||||
|
||||
|
||||
class FakeView(object):
|
||||
"""This fake view is used for enabled z3c forms z2 mode on.
|
||||
|
@ -25,17 +27,10 @@ class FakeView(object):
|
|||
|
||||
@indexer(IThemisFieldIndexer)
|
||||
def dynamic_searchable_text_indexer(obj):
|
||||
"""Dynamic searchable text indexer.
|
||||
"""
|
||||
indexed = [obj.title]
|
||||
|
||||
# We need to make sure that we have z2 mode switched on for z3c form.
|
||||
# Since we do not really have any view to do this on, we just use
|
||||
# a fake view. For switching z2 mode on, it's only necessary that
|
||||
# there is a view.request.
|
||||
view = FakeView(obj, obj.REQUEST)
|
||||
z2.switch_on(view, request_layer=IFormLayer)
|
||||
|
||||
indexed = []
|
||||
if obj.fichier:
|
||||
indexed.append(themis.search.indexer.get_data_to_index(obj, obj.fichier))
|
||||
|
||||
for fieldname in ('numero_courrier', 'mail_ref_id'):
|
||||
try:
|
||||
|
|
Reference in New Issue