def GET(self): input = web.input() res = es.get(input.index, input.type, input.term) def map_name(i): r = i[0] return {"key": r, "val": r, "label": r, "type": i[3]} return json.dumps(map(map_name, res))
def GET(self): web.header('Access-Control-Allow-Origin','*') web.header('Access-Control-Allow-Credentials','true') web.header('Content-Type', 'application/json') def map_tag(i): r = i[1] return {"key": r, "val": r, "label": r} res = es.get("relations.ru", web.input().type, web.input().term) return json.dumps(map(map_tag, res))
def GET(self): web.header('Access-Control-Allow-Origin','*') web.header('Access-Control-Allow-Credentials','true') web.header('Content-Type', 'application/json') res = es.get("person-names.ru", "politic-rus", web.input().term) def map_name(i): r = i[0] return {"key": r, "val": r, "label": r} return json.dumps(map(map_name, res))
def GET(self): web.header('Access-Control-Allow-Origin', '*') web.header('Access-Control-Allow-Credentials', 'true') web.header('Content-Type', 'application/json') def map_tag(i): r = i[1] return {"key": r, "val": r, "label": r} res = es.get("relations.ru", web.input().type, web.input().term) return json.dumps(map(map_tag, res))
def GET(self): web.header('Access-Control-Allow-Origin', '*') web.header('Access-Control-Allow-Credentials', 'true') web.header('Content-Type', 'application/json') res = es.get("person-names.ru", "politic-rus", web.input().term) def map_name(i): r = i[0] return {"key": r, "val": r, "label": r} return json.dumps(map(map_name, res))
def test_get_tag(self): res = es.get("relations.ru", "pp-private", u"дри") print res
def test_get(self): return res = es.get("person-names.ru", "politic-rus", u"васел") print res
def get_es_keys(name): hits = es.get("person-names", "dbpedia", name, id_field_name="key") if len(hits) > 0: return urllib.quote(hits[0][0], safe="~()*!.'") else: return None