Ce serveur Gitlab sera éteint le 30 juin 2020, pensez à migrer vos projets vers les serveurs gitlab-research.centralesupelec.fr et gitlab-student.centralesupelec.fr !

Commit c4454c7c authored by Dos Santos David's avatar Dos Santos David

add search cli

parent c166296a
from gogole.commands import analyze_command
from gogole.commands import index_command
from gogole.commands import analyze_command, index_command, search_command
'analyze': analyze_command.run_analyze_command,
'index': index_command.run_index_command
'index': index_command.run_index_command,
'search': search_command.run
def run(collection, args):
if args.search_query_type == 'boolean':
......@@ -20,7 +20,9 @@ You don't know where to start ? Let me help you !
* index build : I'll build the reversed index for you
* index lookup <token> : I'll tell you in where documents your token is
* search <query> : I'll show you the documents you need
* search <query> : I'll show you the documents you need
search --boolean <query> Your query must be in the Conjunctive normal form
Like "a OR b OR c AND d" is "(a OR b OR c) AND d"
......@@ -54,6 +56,15 @@ def build_cli_index_parser(root_parser):
def build_cli_search_parser(root_parser):
search_parser = root_parser.add_parser('search', description='search for documents')
search_parser.add_argument('--boolean', action='store_const', const='boolean', dest='search_query_type', help="use the booolean model")
search_parser.add_argument('--vectorial', action='store_const', const='vectorial', dest='search_query_type', help="use the vectorial model")
search_parser.add_argument('query', help="your query")
def build_cli_parser():
# cli parser
......@@ -62,6 +73,7 @@ def build_cli_parser():
return cli_parser
......@@ -89,7 +101,6 @@ if __name__ == "__main__":
raw_input = input("gogole > ")
args = cli_parser.parse_args(raw_input.split(' '))
commands.MAIN_COMMANDS_MAP[args.main_command](collection, args)
except SystemExit:
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