diff options
author | Max Magorsch <max@magorsch.de> | 2020-01-06 04:28:05 +0100 |
---|---|---|
committer | Max Magorsch <max@magorsch.de> | 2020-01-06 04:28:05 +0100 |
commit | 110baa8b1c5c919f6a4459f636772fe9e6fc96f9 (patch) | |
tree | 7de4801caa278217fda1cce6eb33aa5ba995f82d | |
parent | Fix the octicons using webpack (diff) | |
download | packages-5-110baa8b1c5c919f6a4459f636772fe9e6fc96f9.tar.gz packages-5-110baa8b1c5c919f6a4459f636772fe9e6fc96f9.tar.bz2 packages-5-110baa8b1c5c919f6a4459f636772fe9e6fc96f9.zip |
Fix the default search behaviour
During the introduction of advanced search queries the default search
behaviour has been changed. The default search is executed when no field
is specified.
However the new default search results aren't as good as the old ones,
that's why old default search behaviour has been restored. A wildcard
search is used as default search again now.
The advanced search queries, that is when specifying a field, aren't
affected by this change.
Signed-off-by: Max Magorsch <max@magorsch.de>
-rw-r--r-- | app/repositories/query_parser/search_query_parser.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/app/repositories/query_parser/search_query_parser.rb b/app/repositories/query_parser/search_query_parser.rb index 34fd2be..38f7622 100644 --- a/app/repositories/query_parser/search_query_parser.rb +++ b/app/repositories/query_parser/search_query_parser.rb @@ -122,11 +122,15 @@ module SearchQueryParser } } else + term = ('*' + term.downcase + '*') unless term.downcase.include? '*' + term.tr!(' ', '*') { - multi_match: { - query: term, - fields: ['atom^3', 'name^2'] - } + wildcard: { + name_sort: { + wildcard: term, + boost: 4 + } + } } end end |