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.component import getAdapters, getMultiAdapter
|
||||||
from zope.interface import alsoProvides
|
from zope.interface import alsoProvides
|
||||||
|
|
||||||
|
import themis.search.indexer
|
||||||
|
|
||||||
|
|
||||||
class FakeView(object):
|
class FakeView(object):
|
||||||
"""This fake view is used for enabled z3c forms z2 mode on.
|
"""This fake view is used for enabled z3c forms z2 mode on.
|
||||||
|
@ -25,17 +27,10 @@ class FakeView(object):
|
||||||
|
|
||||||
@indexer(IThemisFieldIndexer)
|
@indexer(IThemisFieldIndexer)
|
||||||
def dynamic_searchable_text_indexer(obj):
|
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.
|
if obj.fichier:
|
||||||
# Since we do not really have any view to do this on, we just use
|
indexed.append(themis.search.indexer.get_data_to_index(obj, obj.fichier))
|
||||||
# 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 = []
|
|
||||||
|
|
||||||
for fieldname in ('numero_courrier', 'mail_ref_id'):
|
for fieldname in ('numero_courrier', 'mail_ref_id'):
|
||||||
try:
|
try:
|
||||||
|
|
Reference in New Issue