From 7af1ce0df292684d712cefa53d7ddd40202f3be8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20P=C3=A9ters?= Date: Wed, 21 Dec 2011 17:12:34 +0100 Subject: [PATCH] also index title and contents of mails to SearchableText --- themis/indexer/indexer.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/themis/indexer/indexer.py b/themis/indexer/indexer.py index 64becf5..08b5b3f 100644 --- a/themis/indexer/indexer.py +++ b/themis/indexer/indexer.py @@ -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: