Skip to content
Snippets Groups Projects
Commit ab4992d5 authored by felixwelter's avatar felixwelter
Browse files

Refactor SearchIndex

parent 388a66e9
Branches
No related tags found
No related merge requests found
......@@ -22,9 +22,12 @@ class SearchIndex:
writer.add_document(path=path, page=page, content=content)
writer.commit()
def search(self, query):
def result_list(self, query):
query_parser = QueryParser("content", self.ix.schema, group=OrGroup.factory(0.9))
return self.ix.searcher().search(query_parser.parse(query))[0]
return self.ix.searcher().search(query_parser.parse(query))
def search(self, query):
return self.result_list(query)[0]
if __name__ == "__main__":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment