Commit 7d19e0d1903f2842ebe04607c45ef1b8dd4ec2d0

  • avatar
  • arvind
  • Sat Mar 30 10:24:10 IST 2013
Fixing API
		- /search will accept an array of keywords and run a search.
fetch.py
(13 / 7)
  
5050 collection = db['data']
5151 y = 0
5252 ret = {}
53 keywords_dict = json.loads(request.args['data'])
54 keywords = json.loads(keywords_dict)['data']
5355 for i in collection.find():
54 try:
55 if request.args['data'] in i['nodes']:
56 del(i['_id'])
57 ret[y] = i
58 y = y + 1
59 except:
60 pass
56 for keyword in keywords:
57 print keyword
58 try:
59 if keyword in i['nodes']:
60 del(i['_id'])
61 ret[y] = i
62 y = y + 1
63 except:
64 pass
6165 return render_template('blank.html', content = ret)
66
67
6268@app.route('/submit', methods=['POST'])
6369def submit():
6470 c = pymongo.Connection()