Commit c2681d9b authored by 高雅喆's avatar 高雅喆

Merge branch 'master' into gyz_es

parents b5a23082 6cfb0e5a
...@@ -188,10 +188,13 @@ class ESPerform(object): ...@@ -188,10 +188,13 @@ class ESPerform(object):
@classmethod @classmethod
def get_search_results(cls, es_cli, sub_index_name, query_body, offset=0, size=10, def get_search_results(cls, es_cli, sub_index_name, query_body, offset=0, size=10,
auto_create_index=False, doc_type="_doc", aggregations_query=False, is_suggest_request=False, auto_create_index=False, doc_type="_doc", aggregations_query=False, is_suggest_request=False,
batch_search=False, routing=None): batch_search=False, routing=None,if_official_index_name=False):
try: try:
assert (es_cli is not None) assert (es_cli is not None)
if if_official_index_name:
official_index_name = sub_index_name
else:
official_index_name = cls.get_official_index_name(sub_index_name, "read") official_index_name = cls.get_official_index_name(sub_index_name, "read")
index_exists = es_cli.indices.exists(official_index_name) index_exists = es_cli.indices.exists(official_index_name)
if not index_exists: if not index_exists:
......
...@@ -533,15 +533,13 @@ class CollectData(object): ...@@ -533,15 +533,13 @@ class CollectData(object):
linucb_topic_ids_prefix=self.ctr_linucb_recommend_topic_id_prefix, linucb_topic_ids_prefix=self.ctr_linucb_recommend_topic_id_prefix,
linucb_pictorial_ids_prefix=self.ctr_linucb_recommend_pictorial_id_prefix) linucb_pictorial_ids_prefix=self.ctr_linucb_recommend_pictorial_id_prefix)
logging.info("skin_check topic type:%s, device_id:%s, tag_query_results:%s" % logging.info("skin_check topic type:%s, device_id:%s, tag_query_results:%s" %
(str(data['SYS']['action']), str(device_id), str(tag_query_results))) (str(data['SYS']['action']), str(device_id), str(tag_query_results_multi)))
# 品牌问卷进linucb # 品牌问卷进linucb
elif b'content' in raw_val_dict: elif 'SYS' in data and 'APP' in data and 'action' in data['SYS'] and data['SYS']['action'] == "venus/community/survey_question/submit":
data = json.loads(raw_val_dict[b'content'])
if 'SYS' in data and 'APP' in data and 'action' in data['SYS'] and data['SYS']['action'] == "venus/community/survey_question/submit":
device_id = data['SYS']['cl_id'] device_id = data['SYS']['cl_id']
tagid_list = list(data['APP'].get('answer_tag', [])) tagid_list = list(data['APP'].get('answer_tag', []))
user_id = data['SYS'].get('user_id', None) user_id = data['SYS'].get('user_id', None)
logging.info("skin_check topic type:%s, device_id:%s, answer_tag:%s" % logging.info("survey_question type:%s, device_id:%s, answer_tag:%s" %
(str(data['SYS']['action']), str(device_id), str(tagid_list))) (str(data['SYS']['action']), str(device_id), str(tagid_list)))
if len(tagid_list) > 0: if len(tagid_list) > 0:
tag_query_results = list(Tag.objects.using(settings.SLAVE1_DB_NAME).filter( tag_query_results = list(Tag.objects.using(settings.SLAVE1_DB_NAME).filter(
...@@ -579,7 +577,7 @@ class CollectData(object): ...@@ -579,7 +577,7 @@ class CollectData(object):
linucb_topic_ids_prefix=self.ctr_linucb_recommend_topic_id_prefix, linucb_topic_ids_prefix=self.ctr_linucb_recommend_topic_id_prefix,
linucb_pictorial_ids_prefix=self.ctr_linucb_recommend_pictorial_id_prefix) linucb_pictorial_ids_prefix=self.ctr_linucb_recommend_pictorial_id_prefix)
logging.info("survey_question type:%s, device_id:%s, tagid_list:%s" % logging.info("survey_question type:%s, device_id:%s, tagid_list:%s" %
(str(data['SYS']['action']), str(device_id), str(tag_query_results))) (str(data['SYS']['action']), str(device_id), str(tag_query_results_multi)))
else: else:
if msg: if msg:
logging.warning("unknown type msg:%s" % raw_val_dict.get("type", "missing type")) logging.warning("unknown type msg:%s" % raw_val_dict.get("type", "missing type"))
......
...@@ -420,7 +420,7 @@ def pictorial_topic_sort(pictorial_id=-1, offset=0, size=10, sort_type=PICTORIAL ...@@ -420,7 +420,7 @@ def pictorial_topic_sort(pictorial_id=-1, offset=0, size=10, sort_type=PICTORIAL
pict_pictorial_ids_list = [] pict_pictorial_ids_list = []
# 获取es链接对象 # 获取es链接对象
es_cli_obj = ESPerform.get_cli() es_cli_obj = ESPerform.get_cli()
result_dict = ESPerform.get_search_results(es_cli_obj, "topic", q, offset, size) result_dict = ESPerform.get_search_results(es_cli=es_cli_obj, sub_index_name="mv-alpha-topic-prod-190905001", query_body=q, offset=offset, size=size,if_official_index_name=True)
# logging.info("get pictorial_topic_sort res:%s" % result_dict) # logging.info("get pictorial_topic_sort res:%s" % result_dict)
......
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