Commit 319fa131 authored by Dos Santos David's avatar Dos Santos David

refactor run query

parent ee070a38
from gogole import query
def run(collection, args):
q = " ".join(args.query)
query_cls = query.QUERY_MAP[args.search_query_type]
query_browser = query_cls(collection)
query_browser.search(args.query)
print("searching {query} using {model} model".format(
query=q,
model=args.search_query_type
))
query_browser.search(q)
......@@ -19,11 +19,11 @@ class BooleanQuery(Query):
return set.intersection(*doc_ids_by_conjunction)
def search(self, query_lst):
def search(self, query):
"""
Parse a boolean query
and return a list of documents relevant for this query
"""
doc_ids = self.search_documents(" ".join(x.lower() for x in query_lst))
doc_ids = self.search_documents(query)
print("Document ids : {}".format(", ".join(str(x) for x in doc_ids)))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment