Commit 4e98b54b authored by lixiaofang's avatar lixiaofang

add

parent acf4c8e0
...@@ -251,9 +251,9 @@ class TopicUtils(object): ...@@ -251,9 +251,9 @@ class TopicUtils(object):
] ]
if query is not None: # 搜索帖子 if query is not None: # 搜索帖子
multi_fields = { multi_fields = {
#'description': 200, # 'description': 200,
'content': 300, 'content': 300,
#'name': 400, # 'name': 400,
'tag_name_list': 300, 'tag_name_list': 300,
} }
query_fields = ['^'.join((k, str(v))) for (k, v) in multi_fields.items()] query_fields = ['^'.join((k, str(v))) for (k, v) in multi_fields.items()]
...@@ -329,18 +329,18 @@ class TopicUtils(object): ...@@ -329,18 +329,18 @@ class TopicUtils(object):
'query': query, 'query': query,
'type': 'best_fields', 'type': 'best_fields',
'operator': 'and', 'operator': 'and',
'fields': ["content","tag_name_list"], 'fields': ["content", "tag_name_list"],
} }
functions_list += [ functions_list += [
{ {
"weight": 300, "weight": 300,
"filter":{ "filter": {
"bool":{ "bool": {
"must":{ "must": {
"term": {"content_level": 6}, "term": {"content_level": 6},
}, },
"minimum_should_match": 1, "minimum_should_match": 1,
"should":[ "should": [
{'multi_match': multi_match}, {'multi_match': multi_match},
{"term": {"tag_list": tag_id}}, {"term": {"tag_list": tag_id}},
{"term": {"user_nick_name_pre": query.lower()}} {"term": {"user_nick_name_pre": query.lower()}}
...@@ -1067,6 +1067,20 @@ class TopicUtils(object): ...@@ -1067,6 +1067,20 @@ class TopicUtils(object):
} }
}, },
}) })
elif sort_by == TOPIC_SEARCH_SORT.TOPIC_ADD_TIME:
sort_rule.append({
"related_billboard.topic_add_createtime": {
"order": "desc",
"nested_path": "related_billboard",
"nested_filter": {
"term": {
"related_billboard.pictorial_id": pictorial_id
}
}
},
})
logging.info("get picotirial:%s" % sort_rule) logging.info("get picotirial:%s" % sort_rule)
return sort_rule return sort_rule
......
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