-
- text_phrase = SearchResult.aggregate(srch.search_phrase(toks, 'content', fuzzy=fuzzy, tokens_cache=tokens_cache, snippets=True, book=False))
-
- everywhere = srch.search_everywhere(toks, fuzzy=fuzzy, tokens_cache=tokens_cache)
+
+ # Do a phrase search but a term search as well - this can give us better snippets then search_everywhere,
+ # Because the query is using only one field.
+ text_phrase = SearchResult.aggregate(
+ search.search_phrase(toks, 'content', fuzzy=fuzzy, tokens_cache=tokens_cache, snippets=True, book=False, slop=4),
+ search.search_some(toks, ['content'], tokens_cache=tokens_cache, snippets=True, book=False))
+
+ everywhere = search.search_everywhere(toks, fuzzy=fuzzy, tokens_cache=tokens_cache)