diff options
-rw-r--r-- | app.py | 20 |
1 files changed, 10 insertions, 10 deletions
@@ -130,15 +130,15 @@ def get_all_beers(): return jsonify([orig_term_map[x] for x in search(q)]) # return jsonify(names[0:20]) -@app.route('/search', methods=['POST']) -def search(): - q = request.form.get('q') - if not q: - return redirect('/') - brewery, beer_name = q.split(' — ') - print('SEARCHING: ', q) - beer_id, brewery_id = name_list[q].split('-') - return redirect(url_for('get_beer_details', beer_id=beer_id, brewery_id=brewery_id)) +# @app.route('/search', methods=['POST']) +# def search(): +# q = request.form.get('q') +# if not q: +# return redirect('/') +# brewery, beer_name = q.split(' — ') +# print('SEARCHING: ', q) +# beer_id, brewery_id = name_list[q].split('-') +# return redirect(url_for('get_beer_details', beer_id=beer_id, brewery_id=brewery_id)) @@ -152,7 +152,7 @@ def search(query): matches = [x for x in search_words if term in x] # print(matches) for m in matches: - all_matches[m] += 1/len(matches) + all_matches[m] += 1/len(matches)/len(m) return sorted(all_matches, key=lambda x: all_matches[x], reverse=True)[:10] |