From 110baa8b1c5c919f6a4459f636772fe9e6fc96f9 Mon Sep 17 00:00:00 2001 From: Max Magorsch Date: Mon, 6 Jan 2020 04:28:05 +0100 Subject: 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 --- app/repositories/query_parser/search_query_parser.rb | 12 ++++++++---- 1 file 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 -- cgit v1.2.3-65-gdbad