Commit 9a0685fc authored by Kai's avatar Kai

add logging

parent aee8159a
......@@ -456,22 +456,22 @@ class TopicUtils(object):
}
}
]
if len(topic_tag_list) > 0:
functions_list.append(
{
"filter": {"bool": {
"should": {"terms": {"tag_list": topic_tag_list}}}},
"weight": 5000
}
)
if topic_user_id != -1:
functions_list.append(
{
"filter": {"bool": {
"should": {"term": {"user_id": topic_user_id}}}},
"weight": 5000
}
)
# if len(topic_tag_list) > 0:
# functions_list.append(
# {
# "filter": {"bool": {
# "should": {"terms": {"tag_list": topic_tag_list}}}},
# "weight": 5000
# }
# )
# if topic_user_id != -1:
# functions_list.append(
# {
# "filter": {"bool": {
# "should": {"term": {"user_id": topic_user_id}}}},
# "weight": 5000
# }
# )
if len(topic_tag_list) != 0 or topic_user_id!= -1:
query_function_score = {
"query": {
......@@ -513,18 +513,18 @@ class TopicUtils(object):
"functions": functions_list
}
# if len(topic_tag_list) > 0:
# query_function_score["query"]["bool"]["should"] = {
# "terms": {
# "tag_list": topic_tag_list
# }
# }
# if topic_user_id != -1:
# query_function_score["query"]["bool"]["should"] = {
# "term": {
# "user_id": topic_user_id
# }
# }
if len(topic_tag_list) > 0:
query_function_score["query"]["bool"]["filter"] = {
"terms": {
"tag_list": topic_tag_list
}
}
if topic_user_id != -1:
query_function_score["query"]["bool"]["filter"] = {
"term": {
"user_id": topic_user_id
}
}
q["query"]["function_score"] = query_function_score
q["collapse"] = {
"field": "user_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