Commit 42159f63 authored by 段英荣's avatar 段英荣

modify search

parent b6825d93
...@@ -334,13 +334,19 @@ class TopicUtils(object): ...@@ -334,13 +334,19 @@ class TopicUtils(object):
functions_list += [ functions_list += [
{ {
"weight": 400, "weight": 400,
"filter":{
"constant_score":{
"filter":{ "filter":{
"term": {"user_nick_name_pre": query.lower()} "term": {"user_nick_name_pre": query.lower()}
} }
}
}
}, },
{ {
"weight": 300, "weight": 300,
"filter": { "filter": {
"constant_score":{
"filter":{
"bool": { "bool": {
"must": { "must": {
"term": {"content_level": 6}, "term": {"content_level": 6},
...@@ -353,10 +359,14 @@ class TopicUtils(object): ...@@ -353,10 +359,14 @@ class TopicUtils(object):
] ]
} }
} }
}
}
}, },
{ {
"weight": 200, "weight": 200,
"filter": { "filter": {
"constant_score":{
"filter":{
"bool": { "bool": {
"must": { "must": {
"term": {"content_level": 5}, "term": {"content_level": 5},
...@@ -369,10 +379,14 @@ class TopicUtils(object): ...@@ -369,10 +379,14 @@ class TopicUtils(object):
] ]
} }
} }
}
}
}, },
{ {
"weight": 100, "weight": 100,
"filter": { "filter": {
"constant_score":{
"filter":{
"bool": { "bool": {
"must": { "must": {
"term": {"content_level": 4}, "term": {"content_level": 4},
...@@ -386,6 +400,8 @@ class TopicUtils(object): ...@@ -386,6 +400,8 @@ class TopicUtils(object):
} }
} }
} }
}
}
] ]
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