Bugzilla – Attachment 68897 Details for
Bug 17661
Differences in field ending (whitespace, punctuation) cause duplicate facets
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 17661 - Ending punctuation causes duplicate facets
Bug-17661---Ending-punctuation-causes-duplicate-fa.patch (text/plain), 2.00 KB, created by
Nick Clemens (kidclamp)
on 2017-11-02 16:53:56 UTC
(
hide
)
Description:
Bug 17661 - Ending punctuation causes duplicate facets
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2017-11-02 16:53:56 UTC
Size:
2.00 KB
patch
obsolete
>From c7b552068d1d42721029b4d347a4af944887977c Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Thu, 2 Nov 2017 16:52:53 +0000 >Subject: [PATCH] Bug 17661 - Ending punctuation causes duplicate facets > >WIP >--- > C4/Search.pm | 8 +++----- > 1 file changed, 3 insertions(+), 5 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index 9278f26..b2ed1d4 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -630,7 +630,6 @@ sub getRecords { > } > } > ); >- > # This sorts the facets into alphabetical order > if (@facets_loop) { > foreach my $f (@facets_loop) { >@@ -671,7 +670,6 @@ sub _get_facets_from_records { > my $jmax = $size > $facets_maxrecs > ? $facets_maxrecs > : $size; >- > for ( my $j = 0 ; $j < $jmax ; $j++ ) { > > my $marc_record = new_record_from_zebra ( >@@ -706,9 +704,7 @@ facets for Zebra). > sub _get_facets_data_from_record { > > my ( $marc_record, $facets, $facets_counter ) = @_; >- > for my $facet (@$facets) { >- > my @used_datas = (); > > foreach my $tag ( @{ $facet->{ tags } } ) { >@@ -725,6 +721,7 @@ sub _get_facets_data_from_record { > next if $field->indicator(1) eq 'z'; > > my $data = $field->as_string( $subfield_letters, $facet->{ sep } ); >+ $data =~ s/[.\-,]$//; > > unless ( grep { /^\Q$data\E$/ } @used_datas ) { > push @used_datas, $data; >@@ -823,8 +820,9 @@ sub _get_facet_from_result_set { > my $facets = {}; > foreach my $term ( @terms ) { > my $facet_value = $term->textContent; >+ $facet_value =~ s/[.\-,]//; > $facet_value =~ s/\Q$internal_sep\E/$sep/ if defined $sep; >- $facets->{ $facet_value } = $term->getAttribute( 'occur' ); >+ $facets->{ $facet_value } = ( defined $facets->{$facet_value} ) ? $facets->{ $facet_value } + $term->getAttribute( 'occur' ) : $term->getAttribute( 'occur' ); > } > > return $facets; >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17661
:
57658
|
57659
|
68897
|
106637
|
108742
|
109117
|
109242
|
109259
|
109260
|
109368