Commit fe6f5350 authored by lixiaofang's avatar lixiaofang

数据同步

parent 1a9325c1
......@@ -13,7 +13,10 @@ def write_to_es(es_type, pk_list, use_batch_query_set=False):
try:
suggest_index_type = ["doctor_tips", "hospital_tips", "itemwiki_tips", "collectwiki_tips",
'brandwiki_tips', "productwiki_tips", 'tag_tips', 'wordrel_tips']
'brandwiki_tips', "productwiki_tips", 'tag_tips', 'wordrel_tips', 'search_query',
'search_query-v1', "doctor_tips-v1", "hospital_tips-v1", "itemwiki_tips-v1",
"collectwiki_tips-v1", 'brandwiki_tips-v1', "productwiki_tips-v1", 'tag_tips-v1',
'wordrel_tips-v1']
if es_type in suggest_index_type:
pk_list = list(frozenset(pk_list))
type_info_map = get_type_info_map()
......
......@@ -228,6 +228,7 @@ class TypeInfo(object):
else:
instance_list = qs.filter(pk__in=pk_list)
logging.info("get instance_list:%s" % instance_list)
data_list = self.bulk_get_data(instance_list)
self.elasticsearch_bulk_insert_data(
sub_index_name=sub_index_name,
......
......@@ -9,7 +9,6 @@ from libs.es import ESPerform
from libs.cache import redis_client
import json
from django.conf import settings
from trans2es.commons.commons import get_tips_suggest_list, get_tips_suggest_list_v1
from trans2es.commons.words_utils import QueryWordAttr, get_tips_word_type
......@@ -202,3 +201,5 @@ class DoctorTransferV1(object):
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return (dict(), list())
......@@ -8,7 +8,7 @@ from libs.tools import tzlc, getMd5Digest
from libs.es import ESPerform
from libs.cache import redis_client
import json
from trans2es.models.doctor import Doctor
from trans2es.commons.commons import get_tips_suggest_list, get_tips_suggest_list_v1
from trans2es.commons.words_utils import QueryWordAttr, get_tips_word_type
......@@ -35,7 +35,8 @@ class HospitalTransfer(object):
item_dict = dict()
item_dict["id"] = getMd5Digest(str(name))
item_dict["ori_name"] = name
item_dict["is_online"] = instance.is_online
item_dict["is_online"] = by_hospital_id_judge_office_online(is_online=instance.is_online,
hospital_id=instance.id)
item_dict["order_weight"] = QueryWordAttr.get_hospital_query_word_weight(name)
item_dict["results_num"] = QueryWordAttr.get_query_results_num(name)
......@@ -86,7 +87,8 @@ class HospitalTransferV1(object):
item_dict = dict()
item_dict["id"] = getMd5Digest(str(name))
item_dict["ori_name"] = name
item_dict["is_online"] = instance.is_online
item_dict["is_online"] = by_hospital_id_judge_office_online(is_online=instance.is_online,
hospital_id=instance.id)
item_dict["order_weight"] = QueryWordAttr.get_hospital_query_word_weight(name)
item_dict["results_num"] = QueryWordAttr.get_query_results_num(name)
......@@ -115,3 +117,14 @@ class HospitalTransferV1(object):
redis_client.hset(redis_key_prefix, name, pos_list)
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
def by_hospital_id_judge_office_online(is_online=False, hospital_id=None):
try:
office = Doctor.objects.filter(hospital_id=hospital_id, is_online=True, doctor_type=1)
if office and is_online:
return True
return False
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return False
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