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.
  • Diff rendering mode:
  • inline
  • side by side

fetch.py

50 collection = db['data']50 collection = db['data']
51 y = 051 y = 0
52 ret = {}52 ret = {}
53 keywords_dict = json.loads(request.args['data'])
54 keywords = json.loads(keywords_dict)['data']
53 for i in collection.find():55 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
61 return render_template('blank.html', content = ret)65 return render_template('blank.html', content = ret)
66
67
62@app.route('/submit', methods=['POST'])68@app.route('/submit', methods=['POST'])
63def submit():69def submit():
64 c = pymongo.Connection()70 c = pymongo.Connection()