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

(-)a/Koha/SearchEngine/Elasticsearch.pm (-4 / +13 lines)
Lines 485-491 sub _process_mappings { Link Here
485
        }
485
        }
486
        if (defined $options->{filter_callbacks}) {
486
        if (defined $options->{filter_callbacks}) {
487
            # Skip mapping unless all filter callbacks return true
487
            # Skip mapping unless all filter callbacks return true
488
            next unless all { $_->($_data) } @{$options->{filter_callbacks}};
488
            next unless all { $_data = $_->($_data) } @{$options->{filter_callbacks}};
489
        }
489
        }
490
        if (defined $options->{property}) {
490
        if (defined $options->{property}) {
491
            $_data = {
491
            $_data = {
Lines 501-507 sub _process_mappings { Link Here
501
        }
501
        }
502
502
503
        $record_document->{$target} //= [];
503
        $record_document->{$target} //= [];
504
        push @{$record_document->{$target}}, $_data;
504
        if( ref $_data eq 'ARRAY' ){
505
            push @{$record_document->{$target}}, @{$_data};
506
        } else {
507
            push @{$record_document->{$target}}, $_data;
508
        }
505
    }
509
    }
506
}
510
}
507
511
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