Commit 083558ca authored by 段英荣's avatar 段英荣

modify

parent fcbb51c1
...@@ -288,25 +288,40 @@ class ESPerform(object): ...@@ -288,25 +288,40 @@ class ESPerform(object):
def get_tag_topic_list(cls, tag_id, have_read_topic_id_list, size=100): def get_tag_topic_list(cls, tag_id, have_read_topic_id_list, size=100):
try: try:
functions_list = list() functions_list = list()
for id in tag_id: # for id in tag_id:
functions_list.append( # functions_list.append(
{ # {
"filter": {"term": {"tag_list": id}}, # "filter": {"term": {"tag_list": id}},
"weight": 1 # "weight": 1
} # }
) # )
functions_list += [ functions_list += [
{ {
"filter": {"term": {"content_level": 6}}, "filter": {
"weight": 6000 "constant_score":{
"filter":{
"term": {"content_level": 6}}
}
},
"weight": 60
}, },
{ {
"filter": {"term": {"content_level": 5}}, "filter": {
"weight": 5000 "constant_score":{
"filter":{
"term": {"content_level": 5}}
}
},
"weight": 50
}, },
{ {
"filter": {"term": {"content_level": 4}}, "filter": {
"weight": 4000 "constant_score":{
"filter":{
"term": {"content_level": 4}}
}
},
"weight": 40
} }
] ]
q = { q = {
...@@ -333,7 +348,7 @@ class ESPerform(object): ...@@ -333,7 +348,7 @@ class ESPerform(object):
"sort": [ "sort": [
{"_score": {"order": "desc"}}, {"_score": {"order": "desc"}},
{"create_time_val": {"order": "desc"}}, {"create_time_val": {"order": "desc"}},
{"language_type": {"order": "asc"}}, # {"language_type": {"order": "asc"}},
] ]
} }
if len(have_read_topic_id_list) > 0: if len(have_read_topic_id_list) > 0:
......
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