Commit 2956d9aa authored by lixiaofang's avatar lixiaofang

keyword

parent 82c6dc83
...@@ -114,7 +114,7 @@ def search_user(query="", offset=0, size=10): ...@@ -114,7 +114,7 @@ def search_user(query="", offset=0, size=10):
"bool": { "bool": {
"must": [ "must": [
{"term": { {"term": {
"nick_name_pre": query "nick_pre": query
} }
}, { }, {
"term": { "term": {
......
...@@ -4,7 +4,8 @@ ...@@ -4,7 +4,8 @@
"id":{"type":"long"}, "id":{"type":"long"},
"user_id":{"type":"long"}, "user_id":{"type":"long"},
"nick_name":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"}, //昵称 "nick_name":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"}, //昵称
"nick_name_pre":{"type":"text","index":"not_analyzed"}, //昵称 "nick_pre":{"type":"text","analyzer":"keyword"}, //昵称
"nick_name_pre":{"type":"text"}, //昵称
"profile_pic":{"type":"text"}, //头像 "profile_pic":{"type":"text"}, //头像
"gender":{"type":"integer"}, "gender":{"type":"integer"},
"is_online":{"type":"boolean"},//是否上线 "is_online":{"type":"boolean"},//是否上线
......
...@@ -42,6 +42,7 @@ class UserTransfer(object): ...@@ -42,6 +42,7 @@ class UserTransfer(object):
res["user_id"] = instance.user_id res["user_id"] = instance.user_id
res["nick_name"] = instance.nick_name res["nick_name"] = instance.nick_name
res["nick_name_pre"] = instance.nick_name res["nick_name_pre"] = instance.nick_name
res["nick_pre"] = instance.nick_name
res["profile_pic"] = instance.profile_pic res["profile_pic"] = instance.profile_pic
res["gender"] = instance.gender res["gender"] = instance.gender
res["city_id"] = instance.city_id res["city_id"] = instance.city_id
......
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