Commit d63491e5 authored by 段英荣's avatar 段英荣

modify

parent 1a6e3b5d
......@@ -27,6 +27,8 @@ def get_highlight(fields=[]):
@bind("physical/search/query_tag")
def query_tag(query,offset,size):
try:
if query:
query = query.lower()
q = {
"suggest":{
"tips-suggest":{
......
{
"dynamic":"strict",
"properties": {
"id":{"type":"long"},
"suggest":{
"analyzer":"keyword",
"search_analyzer":"keyword",
"type":"completion",
"contexts":[
{
"name":"is_online",
"type": "category",
"path": "is_online"
},
{
"name":"is_deleted",
"type": "category",
"path": "is_deleted"
}
]
},
"name":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"tag_type":{"type":"long"},
"collection":{"type":"long"},
"is_ai":{"type":"long"},
"is_own":{"type":"long"},
"is_online":{"type":"keyword"},//上线
"is_deleted":{"type":"keyword"},
"near_new_topic_num":{"type":"long","store": true}
}
}
......@@ -466,6 +466,16 @@ def get_type_info_map():
round_insert_chunk_size=5,
round_insert_period=2,
),
TypeInfo(
name="tag_v1", # 标签
type="tag_v1",
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,
),
TypeInfo(
name="tag-name", # 标签名字
type="tag-name",
......
......@@ -39,7 +39,7 @@ class TagTransfer(object):
for j in range(i,len(instance.name)+1):
name_term = instance.name[i:j].strip()
if name_term:
tag_name_terms_list.append(name_term)
tag_name_terms_list.append(name_term.lower())
res["suggest"] = {
"input":tag_name_terms_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