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

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

Return to bug 24807