Bug 25957: Don't push blank field values to ES document
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>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
6cfdd79354
commit
eb3d0982ae
|
|
@ -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};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue