Lines 630-636
sub getRecords {
Link Here
|
630 |
} |
630 |
} |
631 |
} |
631 |
} |
632 |
); |
632 |
); |
633 |
|
|
|
634 |
# This sorts the facets into alphabetical order |
633 |
# This sorts the facets into alphabetical order |
635 |
if (@facets_loop) { |
634 |
if (@facets_loop) { |
636 |
foreach my $f (@facets_loop) { |
635 |
foreach my $f (@facets_loop) { |
Lines 671-677
sub _get_facets_from_records {
Link Here
|
671 |
my $jmax = $size > $facets_maxrecs |
670 |
my $jmax = $size > $facets_maxrecs |
672 |
? $facets_maxrecs |
671 |
? $facets_maxrecs |
673 |
: $size; |
672 |
: $size; |
674 |
|
|
|
675 |
for ( my $j = 0 ; $j < $jmax ; $j++ ) { |
673 |
for ( my $j = 0 ; $j < $jmax ; $j++ ) { |
676 |
|
674 |
|
677 |
my $marc_record = new_record_from_zebra ( |
675 |
my $marc_record = new_record_from_zebra ( |
Lines 706-714
facets for Zebra).
Link Here
|
706 |
sub _get_facets_data_from_record { |
704 |
sub _get_facets_data_from_record { |
707 |
|
705 |
|
708 |
my ( $marc_record, $facets, $facets_counter ) = @_; |
706 |
my ( $marc_record, $facets, $facets_counter ) = @_; |
709 |
|
|
|
710 |
for my $facet (@$facets) { |
707 |
for my $facet (@$facets) { |
711 |
|
|
|
712 |
my @used_datas = (); |
708 |
my @used_datas = (); |
713 |
|
709 |
|
714 |
foreach my $tag ( @{ $facet->{ tags } } ) { |
710 |
foreach my $tag ( @{ $facet->{ tags } } ) { |
Lines 725-730
sub _get_facets_data_from_record {
Link Here
|
725 |
next if $field->indicator(1) eq 'z'; |
721 |
next if $field->indicator(1) eq 'z'; |
726 |
|
722 |
|
727 |
my $data = $field->as_string( $subfield_letters, $facet->{ sep } ); |
723 |
my $data = $field->as_string( $subfield_letters, $facet->{ sep } ); |
|
|
724 |
$data =~ s/[.\-,]$//; |
728 |
|
725 |
|
729 |
unless ( grep { /^\Q$data\E$/ } @used_datas ) { |
726 |
unless ( grep { /^\Q$data\E$/ } @used_datas ) { |
730 |
push @used_datas, $data; |
727 |
push @used_datas, $data; |
Lines 823-830
sub _get_facet_from_result_set {
Link Here
|
823 |
my $facets = {}; |
820 |
my $facets = {}; |
824 |
foreach my $term ( @terms ) { |
821 |
foreach my $term ( @terms ) { |
825 |
my $facet_value = $term->textContent; |
822 |
my $facet_value = $term->textContent; |
|
|
823 |
$facet_value =~ s/[.\-,]//; |
826 |
$facet_value =~ s/\Q$internal_sep\E/$sep/ if defined $sep; |
824 |
$facet_value =~ s/\Q$internal_sep\E/$sep/ if defined $sep; |
827 |
$facets->{ $facet_value } = $term->getAttribute( 'occur' ); |
825 |
$facets->{ $facet_value } = ( defined $facets->{$facet_value} ) ? $facets->{ $facet_value } + $term->getAttribute( 'occur' ) : $term->getAttribute( 'occur' ); |
828 |
} |
826 |
} |
829 |
|
827 |
|
830 |
return $facets; |
828 |
return $facets; |
831 |
- |
|
|