Commit 81d19b1f authored by 李小芳's avatar 李小芳

Merge branch 'data' into 'master'

Data

See merge request !22
parents 932c71ce 7e9b86d2
......@@ -27,6 +27,40 @@ def get_suggest_tips(query, agile_tag_type=-1):
index_name = 'associate_tag'
query = query.replace("\u2006", '')
qq = {
"query": {
"bool": {
"must": {
"term": {
"ori_name": query
}
}
}
}
}
logging.info("get qqqqqqqqq:%s" % qq)
whole_query = ESPerform.get_search_results(ESPerform.get_cli(), sub_index_name=index_name, query_body=qq,
offset=0, size=1, is_suggest_request=True)
logging.info("get whole_query:%s" % whole_query)
have_read_tips_set = set()
ret_list = list()
hits = whole_query["hits"]["hits"]
for item in hits:
have_read_tips_set.add(item["_source"]["ori_name"])
agile_tag_id = item["_source"]["agile_tag_id"]
ori_name = item["_source"]["ori_name"]
results_num = item["_source"]["results_num"]
highlight_marks = u'<ems>%s</ems>' % query
item["_source"]["highlight_name"] = item["_source"]["ori_name"].replace(query, highlight_marks)
highlight_name = item["_source"]["highlight_name"]
ret_list.append({"agile_tag_id": agile_tag_id, "ori_name": ori_name, "results_num": results_num,
"highlight": highlight_name})
q = {
"suggest": {
"tips-suggest": {
......@@ -44,8 +78,7 @@ def get_suggest_tips(query, agile_tag_type=-1):
}
}
}
have_read_tips_set = set()
ret_list = list()
result_dict = ESPerform.get_search_results(ESPerform.get_cli(), sub_index_name=index_name, query_body=q,
offset=0, size=50, is_suggest_request=True)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment