From 2acb67d5a190490df2fd0c8520ac47c69cded9fb 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 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: 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 --- C4/Circulation.pm | 1 + Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 1 + 2 files changed, 2 insertions(+) diff --git a/C4/Circulation.pm b/C4/Circulation.pm index 3fd6ceb55a..2253b5cd5a 100644 --- a/C4/Circulation.pm +++ b/C4/Circulation.pm @@ -2751,6 +2751,7 @@ sub CanBookBeRenewed { my $dbh = C4::Context->dbh; my $renews = 1; my $auto_renew = "no"; + my %reasons; my $item = Koha::Items->find($itemnumber) or return ( 0, 'no_item' ); my $issue = $item->checkout or return ( 0, 'no_checkout' ); diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index a087b19789..e00fc5a523 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.11.0