Commit 6c96b6f8 authored by 段英荣's avatar 段英荣

modify search

parent 4d9341b6
This diff is collapsed.
......@@ -29,6 +29,12 @@ from search.utils.common import *
from linucb.views.collect_data import CollectData
from injection.data_sync.tasks import sync_user_similar_score
from trans2es.models.tag import Tag
from libs.cache import redis_client
from trans2es.models.tag import TopicTag
class Job(object):
__es = None
......@@ -189,6 +195,20 @@ class Command(BaseCommand):
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
def sync_tag_collecction_name_set(self):
try:
collection_redis_key_name = "physical:official_tag_name_set"
tag_list = TopicTag.objects.filter(is_online=True, is_collection=True).values_list("tag_id", flat=True)
for tag_id in tag_list:
tag_name = Tag.objects.filter(id=tag_id, is_online=True, is_deleted=False,
is_category=False).values_list("name", flat=True)
if tag_name and len(tag_name)>0 and tag_name[0]:
redis_client.sadd(collection_redis_key_name,tag_name[0])
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
def handle(self, *args, **options):
try:
type_name_list = get_type_info_map().keys()
......@@ -211,5 +231,9 @@ class Command(BaseCommand):
if len(options["sync_type"]) and options["sync_type"]=="similar":
sync_user_similar_score()
if len(options["sync_type"]) and options["sync_type"]=="tagname":
self.sync_tag_collecction_name_set()
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
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