Commit 871c0be6 authored by 段英荣's avatar 段英荣

modify search

parent ba721b65
...@@ -250,18 +250,11 @@ class TopicUtils(object): ...@@ -250,18 +250,11 @@ class TopicUtils(object):
{"terms": {"user_id": linucb_user_id_list}} {"terms": {"user_id": linucb_user_id_list}}
] ]
if query is not None: # 搜索帖子 if query is not None: # 搜索帖子
multi_fields = {
# 'description': 200,
'content': 300,
# 'name': 400,
'tag_name_list': 300,
}
query_fields = ['^'.join((k, str(v))) for (k, v) in multi_fields.items()]
multi_match = { multi_match = {
'query': query, 'query': query,
'type': 'best_fields', 'type': 'best_fields',
'operator': 'or', 'operator': 'or',
'fields': query_fields, 'fields': ["content", "tag_name_list"],
} }
query_function_score["query"]["bool"]["should"] = [ query_function_score["query"]["bool"]["should"] = [
......
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