--- a/fetch.py +++ b/fetch.py @@ -11,6 +11,7 @@ import urllib2 import StringIO import json +import urllib app = Flask(__name__) @@ -33,7 +34,7 @@ resource = "default" if request.args.has_key('uri'): resource = request.args['uri'] - for i in collection.find({'uri':resource}): + for i in collection.find({'resource':resource}): del(i['_id']) ret[x] = i x = x + 1 @@ -50,13 +51,13 @@ y = 0 ret = {} keywords_dict = json.loads(request.args['data']) - keywords = json.loads(keywords_dict)['data'] + #keywords = json.loads(keywords_dict)['data'] for i in collection.find(): - for keyword in keywords: - print keyword + for keyword in keywords_dict: try: if keyword in i['nodes']: del(i['_id']) + i['text'] = urllib.unquote_plus(i['text']) ret[y] = i y = y + 1 except: --- a/static/myVector.js +++ b/static/myVector.js @@ -72,11 +72,12 @@ str['material'] = ans.ans[i]['material']; // str['jewellery'] = ans.ans[i]['jewellery'] } + z = new OpenLayers.Popup.FramedCloud( "test", feature.geometry.getBounds().getCenterLonLat(), new OpenLayers.Size(640,480), - JSON.stringify(str,null,' '),null,true); + '