else:
query = self.index.query()
query = self.apply_filters(query, filters).field_limit(score=True, all_fields=True)
- return [SearchResult(found, how_found='search_words') for found in query.execute()]
+ return [SearchResult(found, how_found='search_words', query_terms=words) for found in query.execute()]
def get_snippets(self, searchresult, query, field='text', num=1):
"""
# We don't need hits which lead to sections but do not have
# snippets.
hits = filter(lambda (idx, h):
- result.snippets[idx] is not None,
+ result.snippets[idx] is not None or 'fragment' in h,
enumerate(result.hits))
# print "[tmpl: from %d hits selected %d]" % (len(result.hits), len(hits))