From 715c2a52ffec76a91c28740d259d6b5179628e8f Mon Sep 17 00:00:00 2001
From: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Date: Fri, 29 May 2015 15:53:31 -0300
Subject: [PATCH] [SIGNED-OFF] Bug 13231: ISBD/AACR2 punctuation causes double
facets
(Reworked patch, original from paxed was a diff file)
Naively remove ISBD punctuation from facets
Using MARC21, assume the following in one biblio:
100 1 $aFoo, $ewriter.
And this in another biblio:
100 1 $aFoo.
This produces double facets, one of "Foo,"
and another for "Foo." -
It should just use one facet, "Foo"
Attached is a quick hack to achieve this.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Test:
2 records modified as proposed, search by author gives 2 facets
With patch only one
No errors
---
C4/Search.pm | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/C4/Search.pm b/C4/Search.pm
index 990ed39..d389045 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -514,6 +514,7 @@ sub getRecords {
my $expandable;
my $number_of_facets;
my @this_facets_array;
+ my %used_facets;
for my $one_facet (
sort {
$facets_counter->{$link_value}
@@ -522,6 +523,9 @@ sub getRecords {
} keys %{ $facets_counter->{$link_value} }
)
{
+ $one_facet =~ s/([^;:.,]) ?[;:.,]$/$1/; # ISBD/AACR2 punctuation
+ next if (defined($used_facets{$one_facet}));
+ $used_facets{$one_facet} = 1;
$number_of_facets++;
if ( ( $number_of_facets <= 5 )
|| ( $expanded_facet eq $link_value )
--
1.7.9.5