summaryrefslogtreecommitdiff
path: root/service/pixelated/adapter/search
diff options
context:
space:
mode:
authorVictor Shyba <victor.shyba@gmail.com>2015-06-12 15:48:04 -0300
committerVictor Shyba <victor.shyba@gmail.com>2015-06-12 15:48:04 -0300
commit42aa76d8463ffe73d5e22d178f8414cfdbd2730e (patch)
tree1a7a4377b8c91d495d3755f3ebe6d3f8bb10dcce /service/pixelated/adapter/search
parent761f4c1232601cb22ce57c38b904c0866f31c577 (diff)
[refactor] SearchEngine does not need a querier
It was used only to retrieve encryption key. This should be done by who is using it.
Diffstat (limited to 'service/pixelated/adapter/search')
-rw-r--r--service/pixelated/adapter/search/__init__.py7
1 files changed, 3 insertions, 4 deletions
diff --git a/service/pixelated/adapter/search/__init__.py b/service/pixelated/adapter/search/__init__.py
index da8845cc..b8d3e7ca 100644
--- a/service/pixelated/adapter/search/__init__.py
+++ b/service/pixelated/adapter/search/__init__.py
@@ -35,8 +35,8 @@ class SearchEngine(object):
DEFAULT_INDEX_HOME = os.path.join(os.environ['HOME'], '.leap')
DEFAULT_TAGS = ['inbox', 'sent', 'drafts', 'trash']
- def __init__(self, soledad_querier, agent_home=DEFAULT_INDEX_HOME):
- self.soledad_querier = soledad_querier
+ def __init__(self, key, agent_home=DEFAULT_INDEX_HOME):
+ self.key = key
self.index_folder = os.path.join(agent_home, 'search_index')
if not os.path.exists(self.index_folder):
os.makedirs(self.index_folder)
@@ -111,8 +111,7 @@ class SearchEngine(object):
raw=TEXT(stored=False))
def _create_index(self):
- masterkey = self.soledad_querier.get_index_masterkey()
- storage = EncryptedFileStorage(self.index_folder, masterkey)
+ storage = EncryptedFileStorage(self.index_folder, self.key)
return FileIndex.create(storage, self._mail_schema(), indexname='mails')
def index_mail(self, mail):