0
0
Fork 0

Fix #hashtag matching non-hashtagged posts in search (#26781)

This commit is contained in:
Eugen Rochko 2023-09-04 10:18:45 +02:00 committed by GitHub
parent a106c46478
commit 68b4e36c82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 44 additions and 12 deletions

View file

@ -53,7 +53,11 @@ class SearchQueryTransformer < Parslet::Transform
end
def to_query
{ multi_match: { type: 'most_fields', query: @term, fields: ['text', 'text.stemmed'], operator: 'and' } }
if @term.start_with?('#')
{ match: { tags: { query: @term } } }
else
{ multi_match: { type: 'most_fields', query: @term, fields: ['text', 'text.stemmed'], operator: 'and' } }
end
end
end