View | Details | Raw Unified | Return to bug 24807
Collapse All | Expand All

(-)a/Koha/SearchEngine/Elasticsearch.pm (-4 / +13 lines)
Lines 481-487 sub _process_mappings { Link Here
481
        }
481
        }
482
        if (defined $options->{filter_callbacks}) {
482
        if (defined $options->{filter_callbacks}) {
483
            # Skip mapping unless all filter callbacks return true
483
            # Skip mapping unless all filter callbacks return true
484
            next unless all { $_->($_data) } @{$options->{filter_callbacks}};
484
            next unless all { $_data = $_->($_data) } @{$options->{filter_callbacks}};
485
        }
485
        }
486
        if (defined $options->{property}) {
486
        if (defined $options->{property}) {
487
            $_data = {
487
            $_data = {
Lines 497-503 sub _process_mappings { Link Here
497
        }
497
        }
498
498
499
        $record_document->{$target} //= [];
499
        $record_document->{$target} //= [];
500
        push @{$record_document->{$target}}, $_data;
500
        if( ref $_data eq 'ARRAY' ){
501
            push @{$record_document->{$target}}, @{$_data};
502
        } else {
503
            push @{$record_document->{$target}}, $_data;
504
        }
501
    }
505
    }
502
}
506
}
503
507
Lines 896-902 sub _field_mappings { Link Here
896
        $default_options->{filter_callbacks} //= [];
900
        $default_options->{filter_callbacks} //= [];
897
        push @{$default_options->{filter_callbacks}}, sub {
901
        push @{$default_options->{filter_callbacks}}, sub {
898
            my ($value) = @_;
902
            my ($value) = @_;
899
            return $value =~ /^\d+$/;
903
            my @years = ();
904
            my @field_years = ( $value =~ /[0-9u]{4}/g );
905
            foreach my $year (@field_years){
906
                $year =~ s/[u]/0/g;
907
                push @years, $year;
908
            }
909
            return \@years;
900
        };
910
        };
901
    }
911
    }
902
912
903
- 

Return to bug 24807