Bug 12478: add the lenient option to the query_string query
authorRobin Sheat <robin@catalyst.net.nz>
Tue, 25 Aug 2015 03:13:51 +0000 (15:13 +1200)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Tue, 26 Apr 2016 20:20:07 +0000 (20:20 +0000)
It doesn't really help.

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Jesse Weaver <jweaver@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher <brendan@bywatersolutions.com>
Koha/ElasticSearch/Indexer.pm
Koha/SearchEngine/Elasticsearch/QueryBuilder.pm
Koha/SearchEngine/Elasticsearch/Search.pm

index ab196a7..06dcb1d 100644 (file)
@@ -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,
             )
         );
     }
index 386073c..bf5154f 100644 (file)
@@ -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,
         }
     };
 
index 6ee8295..3cebed6 100644 (file)
@@ -86,7 +86,7 @@ sub search {
     }
     $self->store(
         Catmandu::Store::ElasticSearch->new(
-            %$params, trace_calls => 1,
+            %$params,
         )
     ) unless $self->store;
     my $error;