diff options
-rw-r--r-- | service/pixelated/adapter/mailstore/searchable_mailstore.py | 12 | ||||
-rw-r--r-- | service/pixelated/adapter/services/mail_service.py | 11 |
2 files changed, 9 insertions, 14 deletions
diff --git a/service/pixelated/adapter/mailstore/searchable_mailstore.py b/service/pixelated/adapter/mailstore/searchable_mailstore.py index d53f13d7..0c5310eb 100644 --- a/service/pixelated/adapter/mailstore/searchable_mailstore.py +++ b/service/pixelated/adapter/mailstore/searchable_mailstore.py @@ -32,18 +32,6 @@ class SearchableMailStore(object): # implementes MailStore setattr(cls, method_name, delegator) @defer.inlineCallbacks - def search_mails(self, query, window_size, page): - mail_ids, total = self._search_engine.search(query, window_size, page) - - try: - mails = yield self.get_mails(mail_ids) - defer.returnValue((mails, total)) - except Exception, e: - import traceback - traceback.print_exc() - raise - - @defer.inlineCallbacks def add_mail(self, mailbox_name, mail): stored_mail = yield self._delegate.add_mail(mailbox_name, mail) self._search_engine.index_mail(stored_mail) diff --git a/service/pixelated/adapter/services/mail_service.py b/service/pixelated/adapter/services/mail_service.py index 2c576e98..ee8e562a 100644 --- a/service/pixelated/adapter/services/mail_service.py +++ b/service/pixelated/adapter/services/mail_service.py @@ -34,8 +34,15 @@ class MailService(object): @defer.inlineCallbacks def mails(self, query, window_size, page): - mails, total = yield self.mail_store.search_mails(query, window_size, page) - defer.returnValue((mails, total)) + mail_ids, total = self.search_engine.search(query, window_size, page) + + try: + mails = yield self.mail_store.get_mails(mail_ids) + defer.returnValue((mails, total)) + except Exception, e: + import traceback + traceback.print_exc() + raise @defer.inlineCallbacks def update_tags(self, mail_id, new_tags): |