From 625579bd5f79d8cc2185f55cb828890bcddaa21e Mon Sep 17 00:00:00 2001 From: wes Date: Tue, 17 Jan 2017 18:28:39 -0500 Subject: [PATCH] remove outdated predict routes, use jsonify for search results --- src/search.py | 6 +++--- src/website.py | 24 +----------------------- 2 files changed, 4 insertions(+), 26 deletions(-) diff --git a/src/search.py b/src/search.py index a9c67d0..e120008 100755 --- a/src/search.py +++ b/src/search.py @@ -5,7 +5,7 @@ import elasticsearch from elasticsearch_dsl import FacetedSearch, Search, Q from elasticsearch_dsl.aggs import Terms, DateHistogram from sys import exit, stderr -from json import dumps, loads +from json import loads from itertools import chain from hashlib import sha1 @@ -175,7 +175,7 @@ def searchTerms(terms): if not qs: # No queries = no results - return dumps([]) + return [] # Reduce joins all of the queries into one query # It will search for the conjunction of all of them @@ -214,7 +214,7 @@ def searchTerms(terms): secs["books"] = "" results.append(secs) - return dumps(results) + return results searchers = { diff --git a/src/website.py b/src/website.py index 17f4e73..8be781a 100755 --- a/src/website.py +++ b/src/website.py @@ -63,27 +63,6 @@ def ClassSearch(configfile=None): return send_from_directory("/srv/http/goal/favicon.ico", 'favicon.ico', mimetype='image/vnd.microsoft.icon') - - @blueprint.route("/buildpred", methods=("GET", "POST")) - def buildpred(): - return predictbuild(request) - - @blueprint.route("/locpred", methods=("GET", "POST")) - def locpred(): - return predictloc(request) - - @blueprint.route("/daypred", methods=("GET", "POST")) - def daypred(): - return predictday(request) - - @blueprint.route("/deptpred", methods=("GET", "POST")) - def deptpred(): - return predictdept(request) - - @blueprint.route("/titlepred", methods=("GET", "POST")) - def titlepred(): - return predicttitle(request) - @blueprint.route("/", methods=("GET", "POST")) def index(): return render_template("search.html") @@ -96,8 +75,7 @@ def ClassSearch(configfile=None): for key, val in params.items(): if val in defaults: del params[key] - results = searchTerms(params) - return results + return jsonify(searchTerms(params)) @blueprint.route("/resources", methods=("GET", "POST")) def resources():