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

(-)a/C4/Search.pm (-9 / +13 lines)
Lines 656-662 sub getRecords { Link Here
656
    C4::Search::_get_facets_data_from_record( $marc_record, $facets, $facets_counter );
656
    C4::Search::_get_facets_data_from_record( $marc_record, $facets, $facets_counter );
657
657
658
Internal function that extracts facets information from a MARC::Record object
658
Internal function that extracts facets information from a MARC::Record object
659
and populates $facets_counter for using in getRecords.
659
and populates $facets_counter and $facets_info for using in getRecords.
660
660
661
$facets is expected to be filled with C4::Koha::getFacets output (i.e. the configured
661
$facets is expected to be filled with C4::Koha::getFacets output (i.e. the configured
662
facets for Zebra).
662
facets for Zebra).
Lines 673-691 sub _get_facets_data_from_record { Link Here
673
673
674
        foreach my $tag ( @{ $facet->{ tags } } ) {
674
        foreach my $tag ( @{ $facet->{ tags } } ) {
675
675
676
            # avoid first line
676
            # tag number is the first three digits
677
            my $tag_num          = substr( $tag, 0, 3 );
677
            my $tag_num          = substr( $tag, 0, 3 );
678
            # subfields are the remainder
678
            my $subfield_letters = substr( $tag, 3 );
679
            my $subfield_letters = substr( $tag, 3 );
679
            # Removed when as_string fixed
680
            my @subfields = $subfield_letters =~ /./sg;
681
680
682
            my @fields = $marc_record->field( $tag_num );
681
            my @fields = $marc_record->field( $tag_num );
683
            foreach my $field (@fields) {
682
            foreach my $field (@fields) {
684
                my $data = $field->as_string( $subfield_letters, $facet->{ sep } );
683
                if ( $field->indicator(1) eq 'z' ) {
684
                    # If $field->indicator(1) eq 'z', it means it is a 'see from'
685
                    # field introduced because of IncludeSeeFromInSearches, so skip it
686
                    next;
687
                } else {
688
                    my $data = $field->as_string( $subfield_letters, $facet->{ sep } );
685
689
686
                unless ( grep { /^\Q$data\E$/ } @used_datas ) {
690
                    unless ( grep { /^\Q$data\E$/ } @used_datas ) {
687
                    push @used_datas, $data;
691
                        push @used_datas, $data;
688
                    $facets_counter->{ $facet->{ idx } }->{ $data }++;
692
                        $facets_counter->{ $facet->{ idx } }->{ $data }++;
693
                    }
689
                }
694
                }
690
            }
695
            }
691
        }
696
        }
692
- 

Return to bug 12788