From 60b4ab8a922d2ac946c81787dc5399668587a0e4 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Wed, 29 May 2019 15:20:41 +0200 Subject: [PATCH] Bug 21534: Always compute wildcards You get no results when searching with an hyphen + with * in query string (or with preference QueryAutoTruncate) : ie /cgi-bin/koha/opac-search.pl?q=saints-anges* Looks like query-string by default does not compute wildcards, see analyze_wildcard in : https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-query-string-query.html Test plan : 1) Use Elasticsearch 2) Create a record with "saints-anges" 3) Search for "saints-anges" => you get results 4) Search for "saints-anges*" => you get results 5) Search for "saints-ang*" => you get results Signed-off-by: Michal Denar Signed-off-by: Arthur Bousquet Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize (cherry picked from commit 001d433b427731a6efd55208ac3169107c830730) Signed-off-by: Fridolin Somers (cherry picked from commit a8cc9d5f49f36a5bf69265f3062f1a7a8ee0fdf4) --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index c8c5e7c937..59e8cc841b 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -92,6 +92,7 @@ sub build_query { default_operator => 'AND', default_field => '_all', lenient => JSON::true, + analyze_wildcard => JSON::true, fields => $options{fields} || [], } }; -- 2.39.5