Commit 6fb0c73d authored by 段英荣's avatar 段英荣

modify

parent 90fd98d3
......@@ -158,7 +158,7 @@ class TopicUtils(object):
"weight": 3,
}
)
elif len(pick_user_id_term_list)>0:
if len(pick_user_id_term_list)>0:
functions_list.append(
{
"filter": {"bool": {
......@@ -166,7 +166,7 @@ class TopicUtils(object):
"weight": 2
}
)
elif len(same_group_user_id_term_list)>0:
if len(same_group_user_id_term_list)>0:
functions_list.append(
{
"filter": {"bool": {
......@@ -176,10 +176,18 @@ class TopicUtils(object):
)
query_tag_term_list = cls.___get_should_term_list(user_tag_list)
if len(query_tag_term_list)>0:
functions_list.append(
{
"filter":{"bool":{
"should":query_tag_term_list}},
"weight": 1
}
)
query_function_score = {
"query": {
"bool": {
"should": query_tag_term_list,
"must": {
"range": {"content_level": {"gte": 3, "lte": 5}}
}
......@@ -204,7 +212,9 @@ class TopicUtils(object):
'operator': 'and',
'fields': query_fields,
}
query_function_score["query"]["bool"]["should"].append({'multi_match': multi_match})
query_function_score["query"]["bool"]["should"] = [
{'multi_match': multi_match}
]
query_function_score["query"]["bool"]["minimum_should_match"] = 1
q["query"]["function_score"] = query_function_score
......
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