summaryrefslogtreecommitdiff
path: root/service
diff options
context:
space:
mode:
authorDuda Dornelles <ddornell@thoughtworks.com>2014-10-22 15:58:15 +0200
committerDuda Dornelles <ddornell@thoughtworks.com>2014-10-22 15:58:15 +0200
commit6fcda106a5f6a0ca5945283e2ebc1f54925a63cf (patch)
treecec703571ed573fb4a58c3664218ed8a98444073 /service
parentb900807f7a0e5ec6a27e6d6314b4bcc0b1988ee9 (diff)
index mails to accept a callback so that we can mark all as not recent when we are done indexing mails
Diffstat (limited to 'service')
-rw-r--r--service/pixelated/adapter/search.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/service/pixelated/adapter/search.py b/service/pixelated/adapter/search.py
index 71b72dba..a5897a12 100644
--- a/service/pixelated/adapter/search.py
+++ b/service/pixelated/adapter/search.py
@@ -129,10 +129,12 @@ class SearchEngine(object):
writer.update_document(**index_data)
- def index_mails(self, mails):
+ def index_mails(self, mails, callback=None):
with self._index.writer() as writer:
for mail in mails:
self._index_mail(writer, mail)
+ if callback:
+ callback()
def _search_with_options(self, options, query):
with self._index.searcher() as searcher: