From acc79a7cdc95a94ecbe3d0e28623528891c81e92 Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Thu, 28 Mar 2019 16:39:28 +0000 Subject: [PATCH] Bug 18969: ES6 - replace use of _all by our own field --- Koha/SearchEngine/Elasticsearch/QueryBuilder.pm | 8 ++++---- admin/searchengine/elasticsearch/field_config.yaml | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm index 252416c..7a131e2 100644 --- a/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm +++ b/Koha/SearchEngine/Elasticsearch/QueryBuilder.pm @@ -90,7 +90,7 @@ sub build_query { query => $query, fuzziness => $fuzzy_enabled ? 'auto' : '0', default_operator => 'AND', - default_field => '_all', + default_field => '_record', lenient => JSON::true, fields => $options{fields} || [], } @@ -230,7 +230,7 @@ sub build_query_compat { join( ' ', $self->_create_query_string(@search_params) ) || (), $self->_join_queries( $self->_convert_index_strings(@$limits) ) || () ); - my @fields = '_all'; + my @fields = '_record'; if ( defined($params->{weighted_fields}) && $params->{weighted_fields} ) { push @fields, sprintf("%s^%s", $_->name, $_->weight) for Koha::SearchFields->weighted_fields; } @@ -301,7 +301,7 @@ sub build_authorities_query { foreach my $s ( @{ $search->{searches} } ) { my ( $wh, $op, $val ) = @{$s}{qw(where operator value)}; - $wh = '_all' if $wh eq ''; + $wh = '_record' if $wh eq ''; if ( $op eq 'is' || $op eq '=' || $op eq 'exact' ) { # look for something that matches a term completely @@ -519,7 +519,7 @@ types. =cut our %index_field_convert = ( - 'kw' => '_all', + 'kw' => '_record', 'ab' => 'abstract', 'au' => 'author', 'lcn' => 'local-classification', diff --git a/admin/searchengine/elasticsearch/field_config.yaml b/admin/searchengine/elasticsearch/field_config.yaml index 0baddf3..5e49042 100644 --- a/admin/searchengine/elasticsearch/field_config.yaml +++ b/admin/searchengine/elasticsearch/field_config.yaml @@ -1,9 +1,6 @@ --- # General field configuration general: - _all: - type: string - analyzer: analyser_standard properties: marc_data: store: true @@ -15,6 +12,9 @@ general: type: text analyzer: keyword index: false + _record: + type: text + analyzer: analyser_standard # Search fields search: @@ -35,7 +35,7 @@ search: search_analyzer: analyser_stdno raw: type: keyword - copy_to: _all + copy_to: _record default: type: text analyzer: analyser_standard @@ -50,7 +50,7 @@ search: lc_raw: type: keyword normalizer: my_normalizer - copy_to: _all + copy_to: _record # Facets facet: default: -- 2.7.4