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