Change account search to be more forgiving of spaces (#34455)
This commit is contained in:
parent
7a70d95435
commit
91db45b197
2 changed files with 47 additions and 5 deletions
|
|
@ -128,11 +128,37 @@ class AccountSearchService < BaseService
|
|||
|
||||
def core_query
|
||||
{
|
||||
multi_match: {
|
||||
query: @query,
|
||||
type: 'best_fields',
|
||||
fields: %w(username^2 display_name^2 text text.*),
|
||||
operator: 'and',
|
||||
dis_max: {
|
||||
queries: [
|
||||
{
|
||||
match: {
|
||||
username: {
|
||||
query: @query,
|
||||
analyzer: 'word_join_analyzer',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
match: {
|
||||
display_name: {
|
||||
query: @query,
|
||||
analyzer: 'word_join_analyzer',
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
{
|
||||
multi_match: {
|
||||
query: @query,
|
||||
type: 'best_fields',
|
||||
fields: %w(text text.*),
|
||||
operator: 'and',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
tie_breaker: 0.5,
|
||||
},
|
||||
}
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue