From aa8e233751118de21c9cbdef578b669545a09375 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Tue, 28 May 2019 15:48:54 +0200 Subject: [PATCH] Bug 22997: Searching gives no results in auth_finder.pl During cataloguing of an existing biblio, on an heading field, the use of tag editor fills authorities finder with existing value : Search main heading ($a only) Search main heading Default operator beeing 'contains'. Actually with Elasticsearch those search give no results. Example with heading : 200 $a Casaubon $b Isaac $f 1559-1614 Call to Elasticsearch : "query" : { "bool" : { "must" : [ { "query_string" : { "query" : "Casaubon*", "default_field" : "heading-main", } }, { "query_string" : { "query" : "(Isaac*) AND (1559-1614*)", "default_field" : "heading" } } ] } }, "sort" : [ { "heading__sort.phrase" : "asc" } ] } Patch adds to "query_string" : analyze_wildcard : true. Test plan : 1) Use Elasticsearch 2) Edit an existing biblio record 3) Use tag editor on a heading 4) Click search => You get correct results 5) Check also search in authorities-home.pl Signed-off-by: Kyle M Hall Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize (cherry picked from commit a94e863c3ed17c177c9ce5d284616791fd5cd380) Signed-off-by: Fridolin Somers --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 4610fb3ee9..7f0db644ae 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -340,7 +340,11 @@ sub build_authorities_query { ); } my $query = $self->_join_queries( @tokens ); - push @query_parts, { query_string => { default_field => $wh, query => $query } }; + push @query_parts, { query_string => { + default_field => $wh, + analyze_wildcard => JSON::true, + query => $query + } }; } } -- 2.39.5