diff options
author | Bruno Wagner <bwagner@thoughtworks.com> | 2014-10-15 16:37:13 +0200 |
---|---|---|
committer | Bruno Wagner <bwagner@thoughtworks.com> | 2014-10-15 16:37:23 +0200 |
commit | c526bab6a5cc91182481d2565b0e762a66572bef (patch) | |
tree | 2d518b533a6b5fe4411e2257d0a76019a046b16d /service/pixelated/adapter/search.py | |
parent | 3ec8dbee135fe67ede676f3c0a882b1ff4fb9701 (diff) |
#101 Raw is now the default search field
Diffstat (limited to 'service/pixelated/adapter/search.py')
-rw-r--r-- | service/pixelated/adapter/search.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/service/pixelated/adapter/search.py b/service/pixelated/adapter/search.py index 859497bb..72e714e9 100644 --- a/service/pixelated/adapter/search.py +++ b/service/pixelated/adapter/search.py @@ -75,7 +75,8 @@ class SearchEngine(object): subject=TEXT(stored=False), body=TEXT(stored=False), tag=KEYWORD(stored=False, commas=True), - flags=KEYWORD(stored=False, commas=True)) + flags=KEYWORD(stored=False, commas=True), + raw=TEXT(stored=False)) def _create_index(self): return whoosh.index.create_in(self.INDEX_FOLDER, self._mail_schema(), indexname='mails') @@ -98,7 +99,8 @@ class SearchEngine(object): 'tag': u','.join(tags), 'body': unicode(mdict['body']), 'ident': unicode(mdict['ident']), - 'flags': unicode(','.join(mail.flags)) + 'flags': unicode(','.join(mail.flags)), + 'raw': unicode(mail.raw) } writer.update_document(**index_data) @@ -110,7 +112,7 @@ class SearchEngine(object): def _search_with_options(self, options, query): with self._index.searcher() as searcher: - query = QueryParser('body', self._index.schema).parse(query) + query = QueryParser('raw', self._index.schema).parse(query) results = searcher.search(query, **options) return results |