Commit abf949d0 authored by 段英荣's avatar 段英荣

modify

parent dd859d9a
...@@ -165,6 +165,7 @@ class ESPerform(object): ...@@ -165,6 +165,7 @@ class ESPerform(object):
cls.create_index(es_cli,sub_index_name) cls.create_index(es_cli,sub_index_name)
cls.put_index_mapping(es_cli,sub_index_name) cls.put_index_mapping(es_cli,sub_index_name)
logging.info("duan add,query_body:%s" % str(query_body).encode("utf-8"))
res = es_cli.search(index=official_index_name,doc_type=doc_type,body=query_body,from_=offset,size=size) res = es_cli.search(index=official_index_name,doc_type=doc_type,body=query_body,from_=offset,size=size)
result_dict = { result_dict = {
"total_count":res["hits"]["total"], "total_count":res["hits"]["total"],
......
...@@ -17,6 +17,8 @@ def home_recommend(user_id=-1,offset=0,size=10): ...@@ -17,6 +17,8 @@ def home_recommend(user_id=-1,offset=0,size=10):
:return: :return:
""" """
try: try:
if not user_id:
user_id=-1
redis_key = "physical:home_recommend:" + "user_id:" + str(user_id) redis_key = "physical:home_recommend:" + "user_id:" + str(user_id)
redis_val_dict = redis_client.hgetall(redis_key) redis_val_dict = redis_client.hgetall(redis_key)
if len(redis_val_dict) > 0: if len(redis_val_dict) > 0:
...@@ -74,6 +76,8 @@ def home_query(user_id=-1,query="",offset=0,size=10): ...@@ -74,6 +76,8 @@ def home_query(user_id=-1,query="",offset=0,size=10):
:return: :return:
""" """
try: try:
if not user_id:
user_id=-1
redis_key = "physical:home_query:" + "user_id:" + str(user_id) redis_key = "physical:home_query:" + "user_id:" + str(user_id)
redis_val_dict = redis_client.hgetall(redis_key) redis_val_dict = redis_client.hgetall(redis_key)
if len(redis_val_dict) > 0: if len(redis_val_dict) > 0:
...@@ -120,3 +124,22 @@ def home_query(user_id=-1,query="",offset=0,size=10): ...@@ -120,3 +124,22 @@ def home_query(user_id=-1,query="",offset=0,size=10):
logging.error("catch exception,err_msg:%s" % traceback.format_exc()) logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return {"recommend_topic_ids": []} return {"recommend_topic_ids": []}
@bind("physical/search/topic_detail_page_recommend")
def topic_detail_page_recommend(user_id=-1,topic_id=-1,topic_group_id=-1,topic_user_id=-1,offset=0,size=10):
"""
:remark:帖子详情页推荐策略
:param user_id:
:param topic_id:
:param topic_group_id:
:param topic_user_id:
:return:
"""
try:
return {"recommend_topic_ids": []}
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return {"recommend_topic_ids": []}
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