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

modify

parent 51e5a3a6
...@@ -27,11 +27,10 @@ class GroupUtils(object): ...@@ -27,11 +27,10 @@ class GroupUtils(object):
q['query'] = { q['query'] = {
'bool': { 'bool': {
"must": { "must": [
"term":{ {"term": {"is_online": True}},
"is_online": True {"term": {"is_deleted": False}}
} ],
},
"should": [ "should": [
{'multi_match': multi_match} {'multi_match': multi_match}
], ],
...@@ -53,11 +52,10 @@ class GroupUtils(object): ...@@ -53,11 +52,10 @@ class GroupUtils(object):
q = dict() q = dict()
q["query"] = { q["query"] = {
"bool":{ "bool":{
"must":{ "must":[
"term":{ {"term": {"is_online": True}},
"is_online": True {"term":{"is_deleted": False}}
} ]
}
} }
} }
q["sort"] = [ q["sort"] = [
...@@ -88,15 +86,11 @@ class GroupUtils(object): ...@@ -88,15 +86,11 @@ class GroupUtils(object):
q = dict() q = dict()
q["query"] = { q["query"] = {
"bool":{ "bool":{
"should":[ "must":[
{"term":{ {"term":{"is_online": True}},
"is_online": True {"term":{"user_id":user_id}},
}}, {"term":{"is_deleted":False}}
{"term":{ ]
"user_id":user_id
}}
],
"minimum_should_match":2
} }
} }
q["_source"] = { q["_source"] = {
......
...@@ -63,7 +63,8 @@ class PickUtils(object): ...@@ -63,7 +63,8 @@ class PickUtils(object):
}, },
"must":[ "must":[
{"term":{"pick_id_list":pick_id}}, {"term":{"pick_id_list":pick_id}},
{"term":{"is_online":True}} {"term":{"is_online":True}},
{"term":{"is_deleted":False}}
] ]
} }
} }
...@@ -108,7 +109,8 @@ class PickUtils(object): ...@@ -108,7 +109,8 @@ class PickUtils(object):
"bool":{ "bool":{
"must":[ "must":[
{"term":{"pick_id_list":pick_id}}, {"term":{"pick_id_list":pick_id}},
{"term":{"is_online":True}} {"term":{"is_online":True}},
{"term":{"is_deleted":False}}
] ]
} }
} }
...@@ -150,7 +152,8 @@ class PickUtils(object): ...@@ -150,7 +152,8 @@ class PickUtils(object):
"bool":{ "bool":{
"must":[ "must":[
{"term":{"pick_id_list":pick_id}}, {"term":{"pick_id_list":pick_id}},
{"term":{"is_online":True}} {"term":{"is_online":True}},
{"term":{"is_deleted":False}}
] ]
} }
} }
......
...@@ -94,11 +94,11 @@ class UserUtils(object): ...@@ -94,11 +94,11 @@ class UserUtils(object):
query_function_score = { query_function_score = {
"query": { "query": {
"bool": { "bool": {
"should": [ "must": [
{"term": {"is_recommend": True}}, {"term": {"is_recommend": True}},
{"term": {"is_online": True}}, {"term": {"is_online": True}},
{"term": {"is_deleted": False}}
], ],
"minimum_should_match":2,
"must_not":{ "must_not":{
"terms":{ "terms":{
"user_id":self_attention_user_id_list "user_id":self_attention_user_id_list
......
...@@ -146,7 +146,7 @@ def topic_detail_page_recommend(user_id=-1,topic_id=-1,topic_group_id=-1,topic_u ...@@ -146,7 +146,7 @@ def topic_detail_page_recommend(user_id=-1,topic_id=-1,topic_group_id=-1,topic_u
try: try:
if not isinstance(user_id,int): if not isinstance(user_id,int):
user_id = -1 user_id = -1
# 获取帖子标签列表 # 获取帖子标签列表
topic_tag_list = TopicUtils.get_topic_tag_id_list(topic_id) topic_tag_list = TopicUtils.get_topic_tag_id_list(topic_id)
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
"is_online":{"type":"boolean"},//上线 "is_online":{"type":"boolean"},//上线
"is_deleted":{"type":"boolean"}, "is_deleted":{"type":"boolean"},
"portrait":{"type":"text"}, "portrait":{"type":"text"},
"name":{"type":"text"}, "name":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"description":{"type":"text"}, "description":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"gender":{"type":"integer"}, "gender":{"type":"integer"},
"city_id":{"type":"text"}, "city_id":{"type":"text"},
"pick_id_list":{"type":"long"}, "pick_id_list":{"type":"long"},
......
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
"is_online":{"type":"boolean"},//上线 "is_online":{"type":"boolean"},//上线
"is_deleted":{"type":"boolean"}, "is_deleted":{"type":"boolean"},
"is_recommend":{"type":"boolean"}, "is_recommend":{"type":"boolean"},
"name":{"type":"text"}, "name":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"description":{"type":"text"}, "description":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"topic_num":{"type":"long"}, "topic_num":{"type":"long"},
"creator_id":{"type":"long"}, "creator_id":{"type":"long"},
"icon":{"type":"text"}, "icon":{"type":"text"},
......
...@@ -3,11 +3,12 @@ ...@@ -3,11 +3,12 @@
"properties": { "properties": {
"id":{"type":"long"}, "id":{"type":"long"},
"is_online":{"type":"boolean"},//上线 "is_online":{"type":"boolean"},//上线
"is_deleted":{"type":"boolean"},
"vote_num":{"type":"long"}, "vote_num":{"type":"long"},
"reply_num":{"type":"long"}, "reply_num":{"type":"long"},
"name":{"type":"text"}, "name":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"description":{"type":"text"}, "description":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"content":{"type":"text"}, "content":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"},
"content_level":{"type":"text"}, "content_level":{"type":"text"},
"user_id":{"type":"long"}, "user_id":{"type":"long"},
"group_id":{"type":"long"}, //所在组ID "group_id":{"type":"long"}, //所在组ID
......
...@@ -3,10 +3,11 @@ ...@@ -3,10 +3,11 @@
"properties": { "properties": {
"id":{"type":"long"}, "id":{"type":"long"},
"user_id":{"type":"long"}, "user_id":{"type":"long"},
"nick_name":{"type":"text"}, //昵称 "nick_name":{"type":"text","analyzer":"gm_default_index","search_analyzer":"gm_default_index"}, //昵称
"profile_pic":{"type":"text"}, //头像 "profile_pic":{"type":"text"}, //头像
"gender":{"type":"integer"}, "gender":{"type":"integer"},
"is_online":{"type":"boolean"},//是否上线 "is_online":{"type":"boolean"},//是否上线
"is_deleted":{"type":"boolean"},
"tag_list":{"type":"long"},//标签属性 "tag_list":{"type":"long"},//标签属性
"city_id":{"type":"text"}, "city_id":{"type":"text"},
"country_id":{"type":"long"}, "country_id":{"type":"long"},
......
...@@ -30,6 +30,7 @@ class User(models.Model): ...@@ -30,6 +30,7 @@ class User(models.Model):
city_id = models.CharField(verbose_name=u'城市id', max_length=40) city_id = models.CharField(verbose_name=u'城市id', max_length=40)
country_id = models.IntegerField(verbose_name='国家id') country_id = models.IntegerField(verbose_name='国家id')
is_online = models.BooleanField(verbose_name="是否上线") is_online = models.BooleanField(verbose_name="是否上线")
is_deleted = models.BooleanField(verbose_name='是否删除')
create_time = models.DateTimeField(verbose_name=u'创建时间',default=datetime.datetime.fromtimestamp(0)) create_time = models.DateTimeField(verbose_name=u'创建时间',default=datetime.datetime.fromtimestamp(0))
update_time = models.DateTimeField(verbose_name=u'更新时间', default=datetime.datetime.fromtimestamp(0)) update_time = models.DateTimeField(verbose_name=u'更新时间', default=datetime.datetime.fromtimestamp(0))
......
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