Bug 12788: facets calculation should skip 100 if ind1=z
This patch adds a test for field 100, to skip it on facet calculation if ind1=z. To test: - Have IncludeSeeFromInSearches set. - Create a biblio record, when adding an author, create a new authority record that contains a 400$a field (see from). - Rebuild zebra db. - Search for the record making sure the search returns more than one record. => FAIL: the facets contain the 'see from' field. - Run $ prove -v t/db_dependent/Search.t => FAIL: it fails - Apply the patch - Run $ prove -v t/db_dependent/Search.t => SUCCESS: it passes - Re-run the search, notice the 'see from' doesn't show anymore on the facets. - Sign off :-D Edit: minor stylistic change Regards To+ Sponsored-by: Universidad Nacional de Cordoba Signed-off-by: Nick Clemens <nick@quecheelibrary.org> Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com> Signed-off-by: Galen Charlton <gmc@esilibrary.com>
This commit is contained in:
parent
5502447d41
commit
9f2c4b7826
11
C4/Search.pm
11
C4/Search.pm
|
|
@ -656,7 +656,7 @@ sub getRecords {
|
|||
C4::Search::_get_facets_data_from_record( $marc_record, $facets, $facets_counter );
|
||||
|
||||
Internal function that extracts facets information from a MARC::Record object
|
||||
and populates $facets_counter for using in getRecords.
|
||||
and populates $facets_counter and $facets_info for using in getRecords.
|
||||
|
||||
$facets is expected to be filled with C4::Koha::getFacets output (i.e. the configured
|
||||
facets for Zebra).
|
||||
|
|
@ -673,14 +673,17 @@ sub _get_facets_data_from_record {
|
|||
|
||||
foreach my $tag ( @{ $facet->{ tags } } ) {
|
||||
|
||||
# avoid first line
|
||||
# tag number is the first three digits
|
||||
my $tag_num = substr( $tag, 0, 3 );
|
||||
# subfields are the remainder
|
||||
my $subfield_letters = substr( $tag, 3 );
|
||||
# Removed when as_string fixed
|
||||
my @subfields = $subfield_letters =~ /./sg;
|
||||
|
||||
my @fields = $marc_record->field( $tag_num );
|
||||
foreach my $field (@fields) {
|
||||
# If $field->indicator(1) eq 'z', it means it is a 'see from'
|
||||
# field introduced because of IncludeSeeFromInSearches, so skip it
|
||||
next if $field->indicator(1) eq 'z';
|
||||
|
||||
my $data = $field->as_string( $subfield_letters, $facet->{ sep } );
|
||||
|
||||
unless ( grep { /^\Q$data\E$/ } @used_datas ) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue