Commit 95ea2075 authored by lixiaofang's avatar lixiaofang

add

parent 5855c068
...@@ -185,27 +185,52 @@ def pictorial_topic(topic_id=-1, offset=0, size=10): ...@@ -185,27 +185,52 @@ 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 = {
"bool": { "query": {
"must": [{ "bool": {
"terms": { "must": [{
"tag_id": topic_tag_list "terms": {
}}, { "tag_id": topic_tag_list
"term": { }}, {
"is_online": True "term": {
} "is_online": True
}, { }
"term": { }, {
"is_deleted": False "term": {
} "is_deleted": False
}, {
"range": {
"topic_id_list": {
"gte": 0
} }
}, {
"range": {
"topic_id_list": {
"gte": 0
}
}
}]
}
}
}
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"] = {
......
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