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

(-)a/Koha/SearchEngine/Elasticsearch.pm (-4 / +13 lines)
Lines 489-495 sub _process_mappings { Link Here
489
        }
489
        }
490
        if (defined $options->{filter_callbacks}) {
490
        if (defined $options->{filter_callbacks}) {
491
            # Skip mapping unless all filter callbacks return true
491
            # Skip mapping unless all filter callbacks return true
492
            next unless all { $_->($_data) } @{$options->{filter_callbacks}};
492
            next unless all { $_data = $_->($_data) } @{$options->{filter_callbacks}};
493
        }
493
        }
494
        if (defined $options->{property}) {
494
        if (defined $options->{property}) {
495
            $_data = {
495
            $_data = {
Lines 505-511 sub _process_mappings { Link Here
505
        }
505
        }
506
506
507
        $record_document->{$target} //= [];
507
        $record_document->{$target} //= [];
508
        push @{$record_document->{$target}}, $_data;
508
        if( ref $_data eq 'ARRAY' ){
509
            push @{$record_document->{$target}}, @{$_data};
510
        } else {
511
            push @{$record_document->{$target}}, $_data;
512
        }
509
    }
513
    }
510
}
514
}
511
515
Lines 900-906 sub _field_mappings { Link Here
900
        $default_options->{filter_callbacks} //= [];
904
        $default_options->{filter_callbacks} //= [];
901
        push @{$default_options->{filter_callbacks}}, sub {
905
        push @{$default_options->{filter_callbacks}}, sub {
902
            my ($value) = @_;
906
            my ($value) = @_;
903
            return $value =~ /^\d+$/;
907
            my @years = ();
908
            my @field_years = ( $value =~ /[0-9u]{4}/g );
909
            foreach my $year (@field_years){
910
                $year =~ s/[u]/0/g;
911
                push @years, $year;
912
            }
913
            return \@years;
904
        };
914
        };
905
    }
915
    }
906
916
907
- 

Return to bug 24807