From 001d433b427731a6efd55208ac3169107c830730 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 --- 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 084d5ad3db..0cbca55331 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