Commit 95ea2075 authored by lixiaofang's avatar lixiaofang

add

parent 5855c068
...@@ -185,7 +185,8 @@ def pictorial_topic(topic_id=-1, offset=0, size=10): ...@@ -185,7 +185,8 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
if len(pictorial_id_list) < 10: if len(pictorial_id_list) < 10:
num = 10 - len(pictorial_id_list) num = 10 - len(pictorial_id_list)
q["query"] = { query = {
"query": {
"bool": { "bool": {
"must": [{ "must": [{
"terms": { "terms": {
...@@ -208,6 +209,30 @@ def pictorial_topic(topic_id=-1, offset=0, size=10): ...@@ -208,6 +209,30 @@ def pictorial_topic(topic_id=-1, offset=0, size=10):
}] }]
} }
} }
}
functions_list = []
functions_list.append({
"filter": {
"constant_score": {
"filter": {
"term": {
"tag_id": topic_tag_list
}
}
}
},
"weight": 20
})
q = {
"query": {
"function_score": {
"query": query,
"score_mode": "sum",
"boost_mode": "sum",
"functions": functions_list
}
}
}
q["_source"] = { q["_source"] = {
"includes": ["id", "tag_id"]} "includes": ["id", "tag_id"]}
q["sort"] = { q["sort"] = {
......
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