From 47d5bc18c56a1a755e7ea39b8bac12203dc7f89b Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Mon, 25 Jun 2012 12:36:45 -0400 Subject: [PATCH] Bug 7475: Update configuration Content-Type: text/plain; charset="UTF-8" In order to make matching rules more useful for MARC21 authorities, this patch adds special indexes on previous see-from headings and LCCN. This patch does not change UNIMARC authority configuration in any way. Also modifies the Koha schema in preparation for adding authority import and matching to the Staging tools. To install: 1. Run installer/data/mysql/atomicupdate/importauthorities.pl 2. Update the following four files in your koha-dev: etc/zebradb/authorities/etc/bib1.att etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl 3. Reindex your authorities: misc/migration_tools/rebuild_zebra.pl -a -r -v NOTE TO RM: this patch adds an atomicupdate file that needs to be incorporated into updatedatabase.pl if bug 7167 is not pushed. http://bugs.koha-community.org/show_bug.cgi?id=2060 Signed-off-by: Elliott Davis Signed-off-by: Jared Camins-Esakov Rebased on master 1 August 2012 --- etc/zebradb/authorities/etc/bib1.att | 1 + .../authorities/authority-koha-indexdefs.xml | 16 +++++++ .../authorities/authority-zebra-indexdefs.xsl | 44 ++++++++++++++++++++ etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl | 17 ++++++++ .../data/mysql/atomicupdate/importauthorities.pl | 26 ++++++++++++ installer/data/mysql/kohastructure.sql | 19 ++++++++- 6 files changed, 122 insertions(+), 1 deletions(-) create mode 100755 installer/data/mysql/atomicupdate/importauthorities.pl diff --git a/etc/zebradb/authorities/etc/bib1.att b/etc/zebradb/authorities/etc/bib1.att index ef462f3..3e0f5fb 100644 --- a/etc/zebradb/authorities/etc/bib1.att +++ b/etc/zebradb/authorities/etc/bib1.att @@ -13,6 +13,7 @@ att 9042 Heading-use-subject-added-entry att 9043 Kind-of-record att 9046 Record-status att 9050 Subject-heading-thesaurus +att 9051 Previous-heading-see-from # Personal Name att 1 Personal-name diff --git a/etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml b/etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml index f1013e1..4599728 100644 --- a/etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml +++ b/etc/zebradb/marc_defs/marc21/authorities/authority-koha-indexdefs.xml @@ -45,6 +45,19 @@ authority-zebra-indexdefs.xsl` Heading-use-series-added-entry:w + + + + LC-card-number:w + LC-card-number:p + + + + + Record-source:w + Record-source:p + + @@ -346,6 +359,9 @@ authority-zebra-indexdefs.xsl` See-from:p See-from:s + + Previous-heading-see-from:p + Match:w Match:p diff --git a/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl b/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl index 6315316..1bafa16 100644 --- a/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl +++ b/etc/zebradb/marc_defs/marc21/authorities/authority-zebra-indexdefs.xsl @@ -13,6 +13,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + @@ -35,6 +36,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + @@ -69,6 +71,24 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + + + + + + + + + + + + + + + + + + @@ -1102,6 +1122,30 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + + + + + + + + + + -- + + + + + + + + + + + + + + diff --git a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl index 59cae26..2316d3f 100644 --- a/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl +++ b/etc/zebradb/xsl/koha-indexdefs-to-zebra.xsl @@ -16,6 +16,7 @@ + @@ -33,6 +34,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + @@ -54,6 +56,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + @@ -64,6 +67,7 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + @@ -279,6 +283,19 @@ definition file (probably something like {biblio,authority}-koha-indexdefs.xml) + + + + + + + + + + + + + diff --git a/installer/data/mysql/atomicupdate/importauthorities.pl b/installer/data/mysql/atomicupdate/importauthorities.pl new file mode 100755 index 0000000..679235e --- /dev/null +++ b/installer/data/mysql/atomicupdate/importauthorities.pl @@ -0,0 +1,26 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use C4::Context; +my $dbh = C4::Context->dbh; + +$dbh->do( +q|CREATE TABLE `import_auths` ( + import_record_id int(11) NOT NULL, + matched_authid int(11) default NULL, + control_number varchar(25) default NULL, + authorized_heading varchar(128) default NULL, + original_source varchar(25) default NULL, + CONSTRAINT import_auths_ibfk_1 FOREIGN KEY (import_record_id) + REFERENCES import_records (import_record_id) ON DELETE CASCADE ON UPDATE CASCADE, + KEY matched_authid (matched_authid) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8;| +); +$dbh->do("ALTER TABLE import_batches + CHANGE COLUMN num_biblios num_records int(11) NOT NULL default 0, + ADD COLUMN record_type enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio'"); +$dbh->do("UPDATE import_batches SET record_type='auth' WHERE import_batch_id IN + (SELECT import_batch_id FROM import_records WHERE record_type='auth')"); + +print "Upgrade done (Added support for staging authorities)\n"; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 69304e1..b46a8a6 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -853,7 +853,7 @@ CREATE TABLE `import_batches` ( -- information about batches of marc records tha `matcher_id` int(11) default NULL, -- the id of the match rule used (matchpoints.matcher_id) `template_id` int(11) default NULL, `branchcode` varchar(10) default NULL, - `num_biblios` int(11) NOT NULL default 0, -- number of bib records in the file + `num_records` int(11) NOT NULL default 0, -- number of records in the file `num_items` int(11) NOT NULL default 0, -- number of items in the file `upload_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP, -- date and time the file was uploaded `overlay_action` enum('replace', 'create_new', 'use_template', 'ignore') NOT NULL default 'create_new', -- how to handle duplicate records @@ -861,6 +861,7 @@ CREATE TABLE `import_batches` ( -- information about batches of marc records tha `item_action` enum('always_add', 'add_only_for_matches', 'add_only_for_new', 'ignore') NOT NULL default 'always_add', -- what to do with item records `import_status` enum('staging', 'staged', 'importing', 'imported', 'reverting', 'reverted', 'cleaned') NOT NULL default 'staging', -- the status of the imported file `batch_type` enum('batch', 'z3950', 'webservice') NOT NULL default 'batch', -- where this batch has come from + `record_type` enum('biblio', 'auth', 'holdings') NOT NULL default 'biblio', -- type of record in the batch `file_name` varchar(100), -- the name of the file uploaded `comments` mediumtext, -- any comments added when the file was uploaded PRIMARY KEY (`import_batch_id`), @@ -909,6 +910,22 @@ CREATE TABLE `import_record_matches` ( -- matches found when importing a batch o ) ENGINE=InnoDB DEFAULT CHARSET=utf8; -- +-- Table structure for table `import_auths` +-- + +DROP TABLE IF EXISTS `import_auths`; +CREATE TABLE `import_auths` ( + `import_record_id` int(11) NOT NULL, + `matched_authid` int(11) default NULL, + `control_number` varchar(25) default NULL, + `authorized_heading` varchar(128) default NULL, + `original_source` varchar(25) default NULL, + CONSTRAINT `import_auths_ibfk_1` FOREIGN KEY (`import_record_id`) + REFERENCES `import_records` (`import_record_id`) ON DELETE CASCADE ON UPDATE CASCADE, + KEY `matched_authid` (`matched_authid`), +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -- Table structure for table `import_biblios` -- -- 1.7.2.5