Commit 811580b4 authored by 段英荣's avatar 段英荣

modify

parent 6433a8c7
......@@ -184,25 +184,6 @@ class TopicUtils(object):
'fields': query_fields,
}
query_function_score["query"]["bool"]["should"].append({'multi_match': multi_match})
"""
q["query"]["bool"] = {
"should": [
{'multi_match': multi_match}
],
"minimum_should_match": 1
}
"""
"""
if not is_first_time:
if group_topic_ids_index:
query_function_score["query"]["bool"]["must"]["range"]["group_id"] = {
"gt": 0
}
else:
query_function_score["query"]["bool"]["must"]["range"]["group_id"] = {
"lt": 0
}
"""
q["query"]["function_score"] = query_function_score
q["_source"] = {
......@@ -213,20 +194,6 @@ class TopicUtils(object):
result_dict = ESPerform.get_search_results(ESPerform.get_cli(), sub_index_name="topic", query_body=q,
offset=offset, size=size)
"""
group_topic_ids = list()
not_group_topic_ids = list()
q["filter"] = {
"range": {"content_level": {"gte": 3, "lte": 5}}
}
for item in result_dict["hits"]:
if item["_source"]["group_id"] and item["_source"]["group_id"]> 0:
group_topic_ids.append(item["_source"]["id"])
else:
not_group_topic_ids.append(item["_source"]["id"])
"""
if len(result_dict["hits"])>0:
return [item["_source"] for item in result_dict["hits"]]
else:
......
......@@ -15,6 +15,7 @@ class PickTopic(models.Model):
db_table = u"picktopic"
id = models.IntegerField(primary_key=True,verbose_name=u"主键ID")
is_deleted = models.BooleanField(verbose_name="是否删除")
topic_id = models.IntegerField(verbose_name=u"帖子ID")
pick_id = models.IntegerField(verbose_name=u"榜ID")
rank = models.IntegerField(verbose_name=u"排名")
......
......@@ -55,7 +55,7 @@ class Topic(models.Model):
def get_pick_id_info(self):
try:
pick_id_list = list()
query_list = PickTopic.objects.filter(topic_id=self.id)
query_list = PickTopic.objects.filter(topic_id=self.id,is_deleted=False)
for item in query_list:
pick_id_list.append(item.pick_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