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

modify linucb topic star-routing

parent 67d5e632
...@@ -378,27 +378,27 @@ class ESPerform(object): ...@@ -378,27 +378,27 @@ class ESPerform(object):
"weight": 1 "weight": 1
} }
) )
functions_list += [ # functions_list += [
{ # {
"filter": {"term": {"content_level": 6}}, # "filter": {"term": {"content_level": 6}},
"weight": 6000 # "weight": 6000
}, # },
{ # {
"filter": {"term": {"content_level": 5}}, # "filter": {"term": {"content_level": 5}},
"weight": 5000 # "weight": 5000
}, # },
{ # {
"filter": {"term": {"content_level": 4}}, # "filter": {"term": {"content_level": 4}},
"weight": 4000 # "weight": 4000
} # }
] # ]
q = { q = {
"query": { "query": {
"function_score": { "function_score": {
"query": { "query": {
"bool": { "bool": {
"must": [ "must": [
{"range": {"content_level": {"gte": 4, "lte": 6}}}, {"term": {"content_level": 6}},
{"term": {"is_online": True}}, {"term": {"is_online": True}},
{"term": {"is_deleted": False}}, {"term": {"is_deleted": False}},
{"terms": {"tag_list": tag_id}} {"terms": {"tag_list": tag_id}}
...@@ -425,8 +425,8 @@ class ESPerform(object): ...@@ -425,8 +425,8 @@ class ESPerform(object):
"id": have_read_topic_id_list "id": have_read_topic_id_list
} }
} }
result_dict = ESPerform.get_search_results(ESPerform.get_cli(), sub_index_name="topic", query_body=q, result_dict = ESPerform.get_search_results(ESPerform.get_cli(), sub_index_name="topic-high-star", query_body=q,
offset=0, size=size, routing="4,5,6") offset=0, size=size, routing="6")
topic_id_list = [item["_source"]["id"] for item in result_dict["hits"]] topic_id_list = [item["_source"]["id"] for item in result_dict["hits"]]
# logging.info("topic_id_list:%s" % str(topic_id_list)) # logging.info("topic_id_list:%s" % str(topic_id_list))
......
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