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

modify

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