From 349ecc34007ccb820ed4913230793ebbe59a36b7 Mon Sep 17 00:00:00 2001 From: Robin Sheat Date: Tue, 25 Aug 2015 15:13:51 +1200 Subject: [PATCH] Bug 12478: add the lenient option to the query_string query It doesn't really help. Signed-off-by: Nick Clemens Signed-off-by: Jesse Weaver Signed-off-by: Tomas Cohen Arazi Signed-off-by: Kyle M Hall Signed-off-by: Brendan Gallagher --- Koha/ElasticSearch/Indexer.pm | 3 --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 6 ++++-- Koha/SearchEngine/Elasticsearch/Search.pm | 2 +- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Koha/ElasticSearch/Indexer.pm b/Koha/ElasticSearch/Indexer.pm index ab196a79f8..06dcb1d3e0 100644 --- a/Koha/ElasticSearch/Indexer.pm +++ b/Koha/ElasticSearch/Indexer.pm @@ -76,7 +76,6 @@ sub update_index { %$params, index_settings => $self->get_elasticsearch_settings(), index_mappings => $self->get_elasticsearch_mappings(), - #trace_calls => 1, ) ); } @@ -119,7 +118,6 @@ sub delete_index { %$params, index_settings => $self->get_elasticsearch_settings(), index_mappings => $self->get_elasticsearch_mappings(), - trace_calls => 1, ) ); } @@ -159,7 +157,6 @@ sub drop_index { %$params, index_settings => $self->get_elasticsearch_settings(), index_mappings => $self->get_elasticsearch_mappings(), - #trace_calls => 1, ) ); } diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 386073c6f4..bf5154fdce 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -41,6 +41,7 @@ provides something that can be given to elasticsearch to get answers. use base qw(Class::Accessor); use Carp; +use JSON; use List::MoreUtils qw/ each_array /; use Modern::Perl; use URI::Escape; @@ -87,8 +88,9 @@ sub build_query { query_string => { query => $query, fuzziness => $fuzzy_enabled ? 'auto' : '0', - default_operator => "AND", - default_field => "_all", + default_operator => 'AND', + default_field => '_all', + lenient => JSON::true, } }; diff --git a/Koha/SearchEngine/Elasticsearch/Search.pm b/Koha/SearchEngine/Elasticsearch/Search.pm index 6ee829500a..3cebed6a20 100644 --- a/Koha/SearchEngine/Elasticsearch/Search.pm +++ b/Koha/SearchEngine/Elasticsearch/Search.pm @@ -86,7 +86,7 @@ sub search { } $self->store( Catmandu::Store::ElasticSearch->new( - %$params, trace_calls => 1, + %$params, ) ) unless $self->store; my $error; -- 2.11.4.GIT