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

modify

parent 43904484
......@@ -195,6 +195,7 @@ class TopicUtils(object):
'description': 200,
'content': 300,
'name': 400,
'tag_name_list':300,
}
query_fields = ['^'.join((k, str(v))) for (k, v) in multi_fields.items()]
multi_match = {
......
......@@ -37,7 +37,6 @@ def home_recommend(session_id="",user_id=-1,offset=0,size=10):
unread_topic_id_list = list()
have_read_topic_id_tuple = set()
logging.info("duan add,last_offset_num:%d" % last_offset_num)
if len(redis_val_dict)>0 and offset>0 and user_id>0 and offset==last_offset_num:
topic_id_list = json.loads(redis_val_dict[b"unread_topic_id"]) + topic_id_list
have_read_topic_id_tuple = set(json.loads(redis_val_dict[b"have_read_topic_id"]))
......
......@@ -13,6 +13,7 @@
"user_id":{"type":"long"},
"group_id":{"type":"long"}, //所在组ID
"tag_list":{"type":"long"},//标签属性
"tag_name_list":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"share_num":{"type":"long"},
"pick_id_list":{"type":"long"},
"offline_score":{"type":"double"},//离线算分
......
......@@ -10,7 +10,7 @@ from django.db import models
import datetime
from .pick_topic import PickTopic
from .tag import TopicTag
from .tag import TopicTag,Tag
from .user_extra import UserExtra
from .group import Group
......@@ -75,7 +75,15 @@ class Topic(models.Model):
return topic_tag_id_list
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return None
return []
def get_tag_name_list(self,tag_id_list):
try:
query_results = Tag.objects.filter(id__in=tag_id_list).values_list("name")
return query_results
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return []
def get_topic_offline_score(self):
try:
......
......@@ -33,6 +33,8 @@ class TopicTransfer(object):
res["pick_id_list"] = instance.get_pick_id_info()
res["tag_list"] = instance.get_topic_tag_id_list()
res["tag_name_list"] = instance.get_tag_name_list(res["tag_list"])
res["offline_score"] = instance.get_topic_offline_score()
create_time = instance.create_time
......
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