diff options
author | Duda Dornelles <ddornell@thoughtworks.com> | 2014-10-22 15:58:15 +0200 |
---|---|---|
committer | Duda Dornelles <ddornell@thoughtworks.com> | 2014-10-22 15:58:15 +0200 |
commit | 6fcda106a5f6a0ca5945283e2ebc1f54925a63cf (patch) | |
tree | cec703571ed573fb4a58c3664218ed8a98444073 | |
parent | b900807f7a0e5ec6a27e6d6314b4bcc0b1988ee9 (diff) |
index mails to accept a callback so that we can mark all as not recent when we are done indexing mails
-rw-r--r-- | service/pixelated/adapter/search.py | 4 |
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: |