Commit 086b6ef5 authored by 段英荣's avatar 段英荣

Merge branch 'master' into 'test'

Master

See merge request alpha/physical!323
parents 39ab9298 5156c4fa
......@@ -32,7 +32,9 @@ class CollectData(object):
def __init__(self):
self.linucb_matrix_redis_prefix = "physical:linucb:device_id:"
#废弃
self.linucb_recommend_redis_prefix = "physical:linucb:tag_recommend:device_id:"
#推荐帖子
self.linucb_recommend_topic_id_prefix = "physical:linucb:topic_recommend:device_id:"
self.tag_topic_id_redis_prefix = "physical:tag_id:topic_id_list:"
self.click_recommend_redis_key_prefix = "physical:click_recommend:device_id:"
......
......@@ -284,7 +284,8 @@ class TopicUtils(object):
query_function_score["query"]["bool"]["should"] = [
{'multi_match': multi_match},
{"term": {"tag_list": tag_id}}
{"term": {"tag_list": tag_id}},
{"term": {"user_nick_name": query}}
]
query_function_score["query"]["bool"]["minimum_should_match"] = 1
else:
......@@ -694,12 +695,6 @@ class TopicUtils(object):
"term": {k: v},
})
if k == "is_complaint":
f.append({
"term": {k: v},
})
if v in (None, '', []):
continue
......@@ -922,7 +917,6 @@ class TopicUtils(object):
}
}
}
}
if query == '':
q["query"] = {
......@@ -930,7 +924,6 @@ class TopicUtils(object):
"must": must,
"must_not": cls.process_nfilters(nfilters),
}
}
if sorts_by:
......
......@@ -25,7 +25,6 @@ def business_topic_search(filters, nfilters=None, sorts_by=None, offset=0, size=
index_name="topic"
)
logging.info("get result_lsit:%s"%result_list)
topic_ids = [item["_source"]["id"] for item in result_list["hits"]]
return {"topic_ids": topic_ids, "total_count": result_list["total_count"]}
except:
......
......@@ -161,20 +161,20 @@ class TypeInfo(object):
ori_topic_star = redis_client.hget(self.physical_topic_star, data["id"])
if ori_topic_star:
ori_topic_star = str(ori_topic_star, encoding="utf-8")
else:
q = {
"query":{
"term":{
"id": data["id"]
}
},
"_source":{
"includes":["content_level"]
}
}
search_results = ESPerform.get_search_results(ESPerform.get_cli(),sub_index_name="topic-star",query_body=q,offset=0,size=1)
if len(search_results["hits"]) > 0:
ori_topic_star = search_results["hits"][0]["_source"]["content_level"]
# else:
# q = {
# "query":{
# "term":{
# "id": data["id"]
# }
# },
# "_source":{
# "includes":["content_level"]
# }
# }
# search_results = ESPerform.get_search_results(ESPerform.get_cli(),sub_index_name="topic-star",query_body=q,offset=0,size=1)
# if len(search_results["hits"]) > 0:
# ori_topic_star = search_results["hits"][0]["_source"]["content_level"]
if not ori_topic_star:
# data_list = [
......
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