aboutsummaryrefslogtreecommitdiff
path: root/app.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/app.py b/app.py
index 42e9055..933a140 100644
--- a/app.py
+++ b/app.py
@@ -17,12 +17,18 @@ app = Flask(__name__)
@app.route("/", methods=['GET', 'POST'])
def search():
query = request.args.get('search')
- if query != '' and query != None:
- response = sphinx.search(query)
+ index = request.args.get('index')
+ if query != '' and query != None and index != '' and index != None:
+ response = sphinx.search(query, index)
elif query is None:
response = {'error': 1, 'msg': 'Use `search` attribute for make a search'}
+ elif index == None:
+ response = {'error': 1, 'msg': 'Use `index` attribute to precise an index'}
+ elif index == '':
+
+ response = {'error': 1, 'msg': '`index` cannot be null'}
else:
- response = {'error': 1, 'msg': 'Query cannot be null'}
+ response = {'error': 1, 'msg': '`search` cannot be null'}
return jsonify(response)
def crawl():