Koha/t/db_dependent/Koha_Authority.t
Jared Camins-Esakov bc05b5d163 Bug 7417: Include see from references in bibliographic searches
This patch adds the Koha::Indexer::RecordNormalizer and
Koha::Indexer::MARC::RecordNormalizer::EmbedSeeFromHeadings packages
to enable the inclusion of alternate forms of headings in bibliographic
searches. When the new syspref IncludeSeeFromInSearches is turned on
(default is off) rebuild_zebra.pl will insert see from headings from
authority records into bibliographic records when indexing, so that a
search on an obsolete term will turn up relevant records.

To test:
1) Enable IncludeSeeFromInSearches
2) Add a heading that has an alternate form to a record (for example,
   "Cooking" has the alternate form "Cookery," if you have authority
   records from LC)
3) Index the zebraqueue (or reindex if you haven't indexed your system
   yet)
4) Confirm that if you search for "Cookery" you get the record you
   just modified

Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Rebased on master 5 August 2012
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
Rebased on master 11 September 2012

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>

Also checked:
- Verified database update works correctly
- Checked system preference and its description
- Checked staff/opac detail pages with feature on/off
- Checked staff/opac search facets
- Downloaded and tested records in various formats
- Tried different searches for 'see from' entries of authorities
- Ran all unit tests

No problems found.
2012-09-13 14:19:28 +02:00

66 lines
1.9 KiB
Perl
Executable file

#!/usr/bin/perl
# Copyright 2012 C & P Bibliography Services
#
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use strict;
use warnings;
use C4::Context;
use Test::More;
BEGIN {
use_ok('Koha::Authority');
}
my $record = MARC::Record->new;
$record->add_fields(
[ '001', '1234' ],
[ '150', ' ', ' ', a => 'Cooking' ],
[ '450', ' ', ' ', a => 'Cookery' ],
);
my $authority = Koha::Authority->new($record);
is(ref($authority), 'Koha::Authority', 'Created valid Koha::Authority object');
is_deeply($authority->record, $record, 'Saved record');
SKIP:
{
my $dbh = C4::Context->dbh;
my $sth = $dbh->prepare("SELECT authid FROM auth_header LIMIT 1;");
$sth->execute();
my $authid;
for my $row ($sth->fetchrow_hashref) {
$authid = $row->{'authid'};
}
skip 'No authorities', 3 unless $authid;
$authority = Koha::Authority->get_from_authid($authid);
is(ref($authority), 'Koha::Authority', 'Retrieved valid Koha::Authority object');
is($authority->authid, $authid, 'Object authid is correct');
is($authority->record->field('001')->data(), $authid, 'Retrieved correct record');
$authority = Koha::Authority->get_from_authid('alphabetsoup');
is($authority, undef, 'No invalid record is retrieved');
}
done_testing();