Commit 1c03f85a authored by lixiaofang's avatar lixiaofang

Merge branch 'test' of git.wanmeizhensuo.com:alpha/physical into test

parents b14bafa0 06905909
......@@ -445,7 +445,7 @@ class TopicUtils(object):
q = dict()
q["query"] = dict()
logging.warning("topic_tag_list:%s"%str(topic_tag_list))
# logging.warning("topic_tag_list:%s"%str(topic_tag_list))
functions_list = [
{
"linear": {
......@@ -456,23 +456,23 @@ class TopicUtils(object):
}
}
]
if len(topic_tag_list) > 0:
functions_list.append(
{
"filter": {"bool": {
"should": {"terms": {"tag_list": topic_tag_list}}}},
"weight": 5000
}
)
if topic_user_id != -1:
functions_list.append(
{
"filter": {"bool": {
"should": {"term": {"user_id": topic_user_id}}}},
"weight": 5000
}
)
if len(topic_tag_list) != 0 or user_id!= -1:
# if len(topic_tag_list) > 0:
# functions_list.append(
# {
# "filter": {"bool": {
# "should": {"terms": {"tag_list": topic_tag_list}}}},
# "weight": 5000
# }
# )
# if topic_user_id != -1:
# functions_list.append(
# {
# "filter": {"bool": {
# "should": {"term": {"user_id": topic_user_id}}}},
# "weight": 5000
# }
# )
if len(topic_tag_list) != 0 or topic_user_id!= -1:
query_function_score = {
"query": {
"bool": {
......@@ -520,7 +520,7 @@ class TopicUtils(object):
}
}
if topic_user_id != -1:
query_function_score["query"]["bool"]["should"] = {
query_function_score["query"]["bool"]["must"] += {
"term": {
"user_id": topic_user_id
}
......
......@@ -300,8 +300,8 @@ def topic_detail_page_recommend(device_id="", user_id=-1, topic_id=-1, topic_pic
if topic_user_id != -1:
topic_user_result = TopicUtils.top_get_topic_detail_recommend_list(user_id, topic_id, have_read_topic_list,
size, es_cli_obj,
index_type="topic", routing="4,5,6",
topic_tag_list=topic_tag_list)
index_type="topic", routing="4,5,6",topic_user_id = topic_user_id
)
topic_user_size = len(topic_user_result)
have_read_topic_list.extend(topic_user_result)
if topic_user_size < size:
......@@ -342,6 +342,9 @@ def topic_detail_page_recommend(device_id="", user_id=-1, topic_id=-1, topic_pic
redis_client.expire(redis_key, 60 * 60 * 24)
result_list = []
logging.warning("topic_tag_result:%s" % str(topic_tag_result))
logging.warning("topic_user_result:%s" % str(topic_user_result))
logging.warning("result:%s" % str(result))
recommend_topic_ids_list = list()
recommend_topic_ids_list.extend(topic_tag_result)
recommend_topic_ids_list.extend(topic_user_result)
......
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