Commit 2e1278d0 authored by 段英荣's avatar 段英荣

modify

parent d0bcfa5e
...@@ -132,11 +132,6 @@ class TopicUtils(object): ...@@ -132,11 +132,6 @@ class TopicUtils(object):
q = dict() q = dict()
q["query"] = dict() q["query"] = dict()
q["query"]["bool"] = {
"must":{
"range": {"content_level": {"gte": 3, "lte": 5}}
}
}
""" """
q["filter"] = { q["filter"] = {
"range": {"content_level": {"gte": 3, "lte": 5}} "range": {"content_level": {"gte": 3, "lte": 5}}
...@@ -162,13 +157,13 @@ class TopicUtils(object): ...@@ -162,13 +157,13 @@ class TopicUtils(object):
"weight": 5, "weight": 5,
}, },
{ {
"filter": {"match": { "filter": {"bool": {
"user_id": pick_user_id_term_list}}, "should": pick_user_id_term_list}},
"weight": 3 "weight": 3
}, },
{ {
"filter": {"match": { "filter": {"bool": {
"user_id": same_group_user_id_term_list}}, "should": same_group_user_id_term_list}},
"weight": 2 "weight": 2
} }
] ]
...@@ -177,7 +172,10 @@ class TopicUtils(object): ...@@ -177,7 +172,10 @@ class TopicUtils(object):
query_function_score = { query_function_score = {
"query": { "query": {
"bool": { "bool": {
"should": query_tag_term_list "should": query_tag_term_list,
"must": {
"range": {"content_level": {"gte": 3, "lte": 5}}
}
} }
}, },
"score_mode": "sum", "score_mode": "sum",
...@@ -199,12 +197,16 @@ class TopicUtils(object): ...@@ -199,12 +197,16 @@ class TopicUtils(object):
'operator': 'and', 'operator': 'and',
'fields': query_fields, 'fields': query_fields,
} }
query_function_score["query"]["bool"]["should"].append({'multi_match': multi_match})
"""
q["query"]["bool"] = { q["query"]["bool"] = {
"should": [ "should": [
{'multi_match': multi_match} {'multi_match': multi_match}
], ],
"minimum_should_match": 1 "minimum_should_match": 1
} }
"""
q["_source"] = { q["_source"] = {
"include":["id","group_id"] "include":["id","group_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