Commit 7fd4ba3e authored by lixiaofang's avatar lixiaofang

add

parent 0b6d21f7
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
import logging import logging
import traceback import traceback
import json import json
from alpha_types.venus import TOPIC_SEARCH_SORT from alpha_types.venus import TOPIC_SEARCH_SORT
from search.views.tag import get_same_tagset_ids from search.views.tag import get_same_tagset_ids
from libs.es import ESPerform from libs.es import ESPerform
...@@ -13,7 +12,6 @@ from search.utils.common import * ...@@ -13,7 +12,6 @@ from search.utils.common import *
from trans2es.models.pictorial import PictorialTopics from trans2es.models.pictorial import PictorialTopics
from libs.cache import redis_client from libs.cache import redis_client
class TopicUtils(object): class TopicUtils(object):
@classmethod @classmethod
......
...@@ -6,7 +6,6 @@ from gm_rpcd.all import bind ...@@ -6,7 +6,6 @@ from gm_rpcd.all import bind
import logging import logging
import traceback import traceback
import json import json
from search.utils.topic import TopicUtils
from libs.es import ESPerform from libs.es import ESPerform
from libs.cache import redis_client from libs.cache import redis_client
from search.utils.common import * from search.utils.common import *
...@@ -16,6 +15,7 @@ from trans2es.models.tag import CommunityTagSetRelation ...@@ -16,6 +15,7 @@ from trans2es.models.tag import CommunityTagSetRelation
from django.conf import settings from django.conf import settings
from libs.error import logging_exception from libs.error import logging_exception
def get_highlight(fields=[]): def get_highlight(fields=[]):
field_highlight = { field_highlight = {
'fields': {k: {} for k in fields}, 'fields': {k: {} for k in fields},
...@@ -236,10 +236,16 @@ def get_same_tagset_ids(tag_list): ...@@ -236,10 +236,16 @@ def get_same_tagset_ids(tag_list):
:return: :return:
""" """
try: try:
all_tag = list()
if isinstance(tag_list, int):
all_tag.append(list)
else:
all_tag = tag_list
tag_set_list_id = list( tag_set_list_id = list(
CommunityTagSetRelation.objects.filter(tag_id__in=tag_list, is_deleted=False).values_list("tag_set_id", CommunityTagSetRelation.objects.filter(tag_id__in=all_tag, is_deleted=False).values_list("tag_set_id",
flat=True)) flat=True))
logging.info("get tag_set_list_id:%s" % tag_set_list_id) logging.info("get tag_set_list_id:%s" % tag_set_list_id)
tag_ids = list( tag_ids = list(
CommunityTagSetRelation.objects.filter(tag_set_id__in=tag_set_list_id, is_deleted=False).values_list( CommunityTagSetRelation.objects.filter(tag_set_id__in=tag_set_list_id, is_deleted=False).values_list(
......
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