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

modify

parent 074d6891
...@@ -193,6 +193,7 @@ class TopicUtils(object): ...@@ -193,6 +193,7 @@ class TopicUtils(object):
if query is not None:#搜索帖子 if query is not None:#搜索帖子
multi_fields = { multi_fields = {
'description': 200, 'description': 200,
'content': 300,
'name': 400, 'name': 400,
} }
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()]
...@@ -203,6 +204,7 @@ class TopicUtils(object): ...@@ -203,6 +204,7 @@ class TopicUtils(object):
'fields': query_fields, 'fields': query_fields,
} }
query_function_score["query"]["bool"]["should"].append({'multi_match': multi_match}) query_function_score["query"]["bool"]["should"].append({'multi_match': multi_match})
query_function_score["minimum_should_match"] = 1
q["query"]["function_score"] = query_function_score q["query"]["function_score"] = query_function_score
q["_source"] = { q["_source"] = {
......
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