Bugzilla – Attachment 110881 Details for
Bug 25957
Elasticsearch 5.X - empty subfields cause error on suggestible fields
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25957: Don't push blank field values to ES document
Bug-25957-Dont-push-blank-field-values-to-ES-docum.patch (text/plain), 2.03 KB, created by
Andrew Fuerste-Henry
on 2020-09-28 16:41:36 UTC
(
hide
)
Description:
Bug 25957: Don't push blank field values to ES document
Filename:
MIME Type:
Creator:
Andrew Fuerste-Henry
Created:
2020-09-28 16:41:36 UTC
Size:
2.03 KB
patch
obsolete
>From 3da421344e1363c74677312d492344dc1c96fde8 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Mon, 28 Sep 2020 15:29:51 +0000 >Subject: [PATCH] Bug 25957: Don't push blank field values to ES document >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >To test: > 1 - Load the sample DB or edit a record (using advanced cataloging editor) to have a blank subfield in a field that is indexed as suggestible > 2 - For example 'author' / 100a > 100 _ _ â¡a > 3 - Index that record into Elasticsearch 5.X: > perl misc/search_tools/rebuild_elasticsearch.pl -v -bn 115 -b -d > 4 - Note error 'value must have length > 0' > 5 - Edit mappings to set author 100a not suggestible > 6 - perl misc/search_tools/rebuild_elasticsearch.pl -v -bn 115 -b -d > 7 - Success > 8 - Set field to suggestible again > 9 - Apply patch >10 - perl misc/search_tools/rebuild_elasticsearch.pl -v -bn 115 -b -d >11 - Success! > >Signed-off-by: Bob Bennhoff <bbennhoff@clicweb.org> >--- > Koha/SearchEngine/Elasticsearch.pm | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/Koha/SearchEngine/Elasticsearch.pm b/Koha/SearchEngine/Elasticsearch.pm >index 1df589c07c..07b3763082 100644 >--- a/Koha/SearchEngine/Elasticsearch.pm >+++ b/Koha/SearchEngine/Elasticsearch.pm >@@ -497,7 +497,7 @@ sub _process_mappings { > next unless @{$values}; > > if (defined $options->{property}) { >- $values = [ map { { $options->{property} => $_ } } @{$values} ]; >+ $values = [ map { { $options->{property} => $_ } if $_} @{$values} ]; > } > if (defined $options->{nonfiling_characters_indicator}) { > my $nonfiling_chars = $meta->{field}->indicator($options->{nonfiling_characters_indicator}); >@@ -507,6 +507,8 @@ sub _process_mappings { > $values->[0] = substr $values->[0], $nonfiling_chars; > } > >+ $values = [ grep(!/^$/, @{$values}) ]; >+ > $record_document->{$target} //= []; > push @{$record_document->{$target}}, @{$values}; > } >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 25957
:
106660
|
106661
|
110877
|
110878
|
110880
|
110881
|
111240
|
111241