From 4c4d8fbdfd31c67169e403cba998350c22b7f8c4 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Fri, 20 Nov 2020 19:11:10 +0000 Subject: [PATCH] Bug 27070: Add cross_fields type to our searches MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch adds the 'cross_fields' type to our searches: https://www.elastic.co/guide/en/elasticsearch/reference/6.8/query-dsl-query-string-query.html#query-string-syntax Without this patch the search terms seem to all require being in the same field when using Elasticsearch 6 To test: 0 - Set QueryAutoTruncate to 'only if * is added' 1 - Find a record with a title and publisher 2 - Search for a word form the title and confirm the record is returned 3 - Search for a work from the title and the publisher's name 4 - The record is not returned 5 - Apply patch 6 - Repeat #3 7 - The record is returned Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Joonas Kylmälä Signed-off-by: Jonathan Druart (cherry picked from commit 03f15d13c5bb931c03aa1487a3887bdaa034b06f) Signed-off-by: Andrew Fuerste-Henry --- 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 d49de32eea..eb86e5a30d 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -100,6 +100,7 @@ sub build_query { fields => $fields, lenient => JSON::true, analyze_wildcard => JSON::true, + type => 'cross_fields', } }; -- 2.39.5