Commit 463fc036 authored by 段英荣's avatar 段英荣

modify

parent 91f5a2c5
{
"dynamic":"strict",
"properties": {
"suggest":{"type":"completion"},
"name":{"type":"text"}//上线
}
}
\ No newline at end of file
......@@ -12,12 +12,13 @@ import elasticsearch
import elasticsearch.helpers
import sys
from trans2es.models import topic,user,pick_celebrity,group,celebrity
from trans2es.models import topic,user,pick_celebrity,group,celebrity,tag
from trans2es.utils.user_transfer import UserTransfer
from trans2es.utils.pick_celebrity_transfer import PickCelebrityTransfer
from trans2es.utils.group_transfer import GroupTransfer
from trans2es.utils.topic_transfer import TopicTransfer
from trans2es.utils.celebrity_transfer import CelebrityTransfer
from trans2es.utils.tag_transfer import TagTransfer
from libs.es import ESPerform
__es = None
......@@ -286,6 +287,16 @@ def get_type_info_map():
bulk_insert_chunk_size=100,
round_insert_chunk_size=5,
round_insert_period=2,
),
TypeInfo(
name="tag", # 标签
type="tag",
model=tag.Tag,
query_deferred=lambda: tag.Tag.objects.all().query,
get_data_func=TagTransfer.get_tag_data,
bulk_insert_chunk_size=100,
round_insert_chunk_size=5,
round_insert_period=2,
)
]
......
......@@ -38,4 +38,4 @@ class GroupTransfer(object):
return res
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return None
\ No newline at end of file
return dict()
\ No newline at end of file
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import logging
import traceback
from libs.tools import tzlc
class TagTransfer(object):
@classmethod
def get_tag_data(cls,instance):
try:
res = dict()
res["suggest"] = instance.name
res["name"] = instance.name
return res
except:
logging.error("catch exception,err_msg:%s" % traceback.format_exc())
return dict()
\ No newline at end of file
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