Commit 05e45ec8 authored by 段英荣's avatar 段英荣

modify

parent 6eae2072
...@@ -134,7 +134,7 @@ class TopicUtils(object): ...@@ -134,7 +134,7 @@ class TopicUtils(object):
""" """
try: try:
attention_user_id_list = list() attention_user_id_list = list()
pick_user_id_list = list() # pick_user_id_list = list()
# same_group_id_list = list() # same_group_id_list = list()
user_tag_list = list() user_tag_list = list()
...@@ -145,8 +145,8 @@ class TopicUtils(object): ...@@ -145,8 +145,8 @@ class TopicUtils(object):
attention_user_info_list = result_dict["hits"][0]["_source"]["attention_user_id_list"] attention_user_info_list = result_dict["hits"][0]["_source"]["attention_user_id_list"]
attention_user_id_list = [item["user_id"] for item in attention_user_info_list] attention_user_id_list = [item["user_id"] for item in attention_user_info_list]
pick_user_info_list = result_dict["hits"][0]["_source"]["pick_user_id_list"] # pick_user_info_list = result_dict["hits"][0]["_source"]["pick_user_id_list"]
pick_user_id_list = [item["user_id"] for item in pick_user_info_list] # pick_user_id_list = [item["user_id"] for item in pick_user_info_list]
# same_pictorial_user_info_list = result_dict["hits"][0]["_source"]["same_pictorial_user_id_list"] # same_pictorial_user_info_list = result_dict["hits"][0]["_source"]["same_pictorial_user_id_list"]
# #
...@@ -165,7 +165,7 @@ class TopicUtils(object): ...@@ -165,7 +165,7 @@ class TopicUtils(object):
"language_type": 1 "language_type": 1
} }
}, },
"weight": 3 "weight": 4
}, },
{ {
"gauss": { "gauss": {
...@@ -174,7 +174,7 @@ class TopicUtils(object): ...@@ -174,7 +174,7 @@ class TopicUtils(object):
"decay": 0.99 "decay": 0.99
} }
}, },
"weight": 3 "weight": 5
} }
] ]
...@@ -197,14 +197,14 @@ class TopicUtils(object): ...@@ -197,14 +197,14 @@ class TopicUtils(object):
"weight": 3, "weight": 3,
} }
) )
if len(pick_user_id_list) > 0: # if len(pick_user_id_list) > 0:
functions_list.append( # functions_list.append(
{ # {
"filter": {"bool": { # "filter": {"bool": {
"should": {"terms": {"user_id": pick_user_id_list}}}}, # "should": {"terms": {"user_id": pick_user_id_list}}}},
"weight": 2 # "weight": 2
} # }
) # )
# if len(same_pictorial_id_list) > 0: # if len(same_pictorial_id_list) > 0:
# functions_list.append( # functions_list.append(
...@@ -225,12 +225,24 @@ class TopicUtils(object): ...@@ -225,12 +225,24 @@ class TopicUtils(object):
} }
) )
if len(recommend_tag_list)>0: if len(recommend_tag_list)>0:
functions_list.append( if len(recommend_tag_list)>1:
{ functions_list += [
"filter": {"terms": {"tag_list": recommend_tag_list}}, {
"weight": 3 "filter": {"terms": {"tag_list": recommend_tag_list[0]}},
} "weight": 4
) },
{
"filter": {"terms": {"tag_list": recommend_tag_list[1:]}},
"weight": 3
}
]
else:
functions_list.append(
{
"filter": {"terms": {"tag_list": recommend_tag_list}},
"weight": 3
}
)
# for tag_id in recommend_tag_dict: # for tag_id in recommend_tag_dict:
# functions_list.append( # functions_list.append(
......
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