Commit 0a141a87 authored by 段英荣's avatar 段英荣

modify bug

parent cba922ce
......@@ -160,6 +160,7 @@ class TopicUtils(object):
q = dict()
ret_data_list = list()
topic_id_list = list()
q["query"] = dict()
......@@ -452,12 +453,14 @@ class TopicUtils(object):
offset=offset, size=size, routing=routing)
for item in result_dict["hits"]:
topic_id_list.append({"id": item["_source"]["id"], "highlight": item.get("highlight", {})})
ret_data_list.append({"id": item["_source"]["id"], "highlight": item.get("highlight", {})})
topic_id_list.append(item["_source"]["id"])
return topic_id_list
return topic_id_list,ret_data_list
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return list()
return list(),list()
@classmethod
def userful_tag_topic_list(cls, user_id, have_read_topic_list, size,
......
......@@ -29,7 +29,7 @@ def get_discover_page_topic_ids(user_id, device_id, size, query_type=TopicPageTy
if have_read_topic_id_list == None:
have_read_topic_id_list = list()
recommend_topic_ids = TopicUtils.get_recommend_topic_ids(user_id=user_id, tag_id=0, offset=0, size=size,
recommend_topic_ids,ret_data_list = TopicUtils.get_recommend_topic_ids(user_id=user_id, tag_id=0, offset=0, size=size,
single_size=size,
query_type=query_type,
filter_topic_id_list=have_read_topic_id_list,
......@@ -160,8 +160,9 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
# for topic_id in promote_recommend_topic_id_list:
# have_read_topic_id_list_add_promote.append(topic_id)
rank_topic_id_list = list()
ret_data_list = list()
if size > 0:
rank_topic_id_list = TopicUtils.get_recommend_topic_ids(user_id=user_id, tag_id=tag_id, offset=0, size=size,
rank_topic_id_list,ret_data_list = TopicUtils.get_recommend_topic_ids(user_id=user_id, tag_id=tag_id, offset=0, size=size,
single_size=size, query=query,
query_type=query_type,
filter_topic_id_list=have_read_topic_id_list,
......@@ -199,9 +200,9 @@ def get_home_recommend_topic_ids(user_id, device_id, tag_id, offset, size, query
# 每个session key保存60天
redis_client.expire(redis_key, 60 * 60 * 24 * 60)
if usefulrecall != -1:
return recommend_topic_list, rank_topic_id_list, useful_topic_id_list
return recommend_topic_list, ret_data_list, useful_topic_id_list
else:
return recommend_topic_list, rank_topic_id_list
return recommend_topic_list, ret_data_list
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
if usefulrecall != -1:
......@@ -512,7 +513,7 @@ def query_topic_by_user_similarity(topic_similarity_score_dict, offset=0, size=1
try:
must_topic_id_list = list(topic_similarity_score_dict.keys())
topic_id_list = TopicUtils.get_recommend_topic_ids(tag_id=0, user_id=-1, offset=offset, size=size,
topic_id_list,ret_data_list = TopicUtils.get_recommend_topic_ids(tag_id=0, user_id=-1, offset=offset, size=size,
single_size=size,
must_topic_id_list=must_topic_id_list, index_type="topic",
routing="4,5,6")
......
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