diff --git a/file_indexer_api/__main__.py b/file_indexer_api/__main__.py index f43c22f..a613808 100644 --- a/file_indexer_api/__main__.py +++ b/file_indexer_api/__main__.py @@ -3,3 +3,4 @@ if __name__ == '__main__': app.run() + diff --git a/file_indexer_api/controllers/search_controller.py b/file_indexer_api/controllers/search_controller.py index d2053f7..02ef24a 100644 --- a/file_indexer_api/controllers/search_controller.py +++ b/file_indexer_api/controllers/search_controller.py @@ -1,5 +1,13 @@ from flask_restful import Resource, reqparse +from rpyc import connect + +parser = reqparse.RequestParser() +parser.add_argument('query') class SearchController(Resource): - def get(self): - return {'message': 'SearchController'} + def post(self): + args = parser.parse_args() + connection = connect('localhost', 18861, config={"allow_all_attrs": True}) + result = connection.root.search(args['query']) + + return {'data': result} diff --git a/file_indexer_api/entities/indexer.py b/file_indexer_api/entities/indexer.py index 3b06648..a68adc4 100644 --- a/file_indexer_api/entities/indexer.py +++ b/file_indexer_api/entities/indexer.py @@ -1,6 +1,6 @@ from file_indexer_api.common.connection_handler_factory import ConnectionHandlerFactory -class Indexer(): +class Indexer: def __init__(self): self.indexer = ConnectionHandlerFactory.create_connection_handler('indexer')