[open-ils-commits] r16448 - in trunk/Open-ILS: examples src/perlmods/OpenILS/Application src/perlmods/OpenILS/Application/Storage src/perlmods/OpenILS/Application/Storage/CDBI src/perlmods/OpenILS/Application/Storage/Driver/Pg src/perlmods/OpenILS/Application/Storage/Publisher src/sql/Pg src/sql/Pg/upgrade (miker)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue May 18 15:10:12 EDT 2010
Author: miker
Date: 2010-05-18 15:10:07 -0400 (Tue, 18 May 2010)
New Revision: 16448
Added:
trunk/Open-ILS/src/sql/Pg/upgrade/0265.schema.identifier-search-class.sql
Modified:
trunk/Open-ILS/examples/fm_IDL.xml
trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm
trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm
trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/metabib.pm
trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm
trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/authority.pm
trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
trunk/Open-ILS/src/sql/Pg/030.schema.metabib.sql
trunk/Open-ILS/src/sql/Pg/800.fkeys.sql
trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
identifier search class, including some (I believe) sane default index defs
Modified: trunk/Open-ILS/examples/fm_IDL.xml
===================================================================
--- trunk/Open-ILS/examples/fm_IDL.xml 2010-05-18 16:53:33 UTC (rev 16447)
+++ trunk/Open-ILS/examples/fm_IDL.xml 2010-05-18 19:10:07 UTC (rev 16448)
@@ -1734,6 +1734,7 @@
<field reporter:label="Indexed Keyword Field Entries" name="keyword_field_entries" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Indexed Subject Field Entries" name="subject_field_entries" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Indexed Title Field Entries" name="title_field_entries" oils_persist:virtual="true" reporter:datatype="link"/>
+ <field reporter:label="Indexed Identifier Field Entries" name="identifier_field_entries" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Indexed Author Field Entries" name="author_field_entries" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Indexed Series Field Entries" name="series_field_entries" oils_persist:virtual="true" reporter:datatype="link"/>
<field reporter:label="Flattened MARC Fields " name="full_record_entries" oils_persist:virtual="true" reporter:datatype="link"/>
@@ -1751,6 +1752,7 @@
<link field="language" reltype="might_have" key="record" map="item_lang" class="mrd"/>
<link field="subject_field_entries" reltype="has_many" key="source" map="" class="msfe"/>
<link field="title_field_entries" reltype="has_many" key="source" map="" class="mtfe"/>
+ <link field="identifier_field_entries" reltype="has_many" key="source" map="" class="mife"/>
<link field="notes" reltype="has_many" key="record" map="" class="bren"/>
<link field="author_field_entries" reltype="has_many" key="source" map="" class="mafe"/>
<link field="series_field_entries" reltype="has_many" key="source" map="" class="msefe"/>
@@ -2124,6 +2126,8 @@
UNION ALL
SELECT * FROM metabib.keyword_field_entry
UNION ALL
+ SELECT * FROM metabib.identifier_field_entry
+ UNION ALL
SELECT * FROM metabib.title_field_entry
UNION ALL
SELECT * FROM metabib.subject_field_entry
@@ -2149,6 +2153,8 @@
UNION ALL
SELECT * FROM metabib.keyword_field_entry
UNION ALL
+ SELECT * FROM metabib.identifier_field_entry
+ UNION ALL
SELECT * FROM metabib.title_field_entry
UNION ALL
SELECT * FROM metabib.subject_field_entry
@@ -4044,6 +4050,18 @@
<link field="circ_lib" reltype="has_a" key="id" map="" class="aou"/>
</links>
</class>
+ <class id="mife" controller="open-ils.cstore" oils_obj:fieldmapper="metabib::identifier_field_entry" oils_persist:tablename="metabib.identifier_field_entry" reporter:label="Identifier Field Entry">
+ <fields oils_persist:primary="id" oils_persist:sequence="metabib.identifier_field_entry_id_seq">
+ <field name="field" reporter:datatype="link"/>
+ <field name="id" reporter:datatype="id" />
+ <field name="source" reporter:datatype="link"/>
+ <field name="value" reporter:datatype="text"/>
+ </fields>
+ <links>
+ <link field="source" reltype="has_a" key="id" map="" class="bre"/>
+ <link field="field" reltype="has_a" key="id" map="" class="cmf"/>
+ </links>
+ </class>
<class id="mtfe" controller="open-ils.cstore" oils_obj:fieldmapper="metabib::title_field_entry" oils_persist:tablename="metabib.title_field_entry" reporter:label="Title Field Entry">
<fields oils_persist:primary="id" oils_persist:sequence="metabib.title_field_entry_id_seq">
<field name="field" reporter:datatype="link"/>
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm 2010-05-18 16:53:33 UTC (rev 16447)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Ingest.pm 2010-05-18 19:10:07 UTC (rev 16448)
@@ -209,7 +209,7 @@
$cstore->request( 'open-ils.cstore.direct.metabib.record_descriptor.create' => $blob->{descriptor} )->gather(1);
# deal with classed fields...
- for my $class ( qw/title author subject keyword series/ ) {
+ for my $class ( qw/title author subject keyword series identifier/ ) {
$tmp = $cstore->request(
"open-ils.cstore.direct.metabib.${class}_field_entry.id_list.atomic",
{ source => $bib->id }
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/metabib.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/metabib.pm 2010-05-18 16:53:33 UTC (rev 16447)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI/metabib.pm 2010-05-18 19:10:07 UTC (rev 16448)
@@ -13,6 +13,15 @@
metabib::metarecord->columns( Essential => qw/fingerprint master_record mods/ );
#-------------------------------------------------------------------------------
+package metabib::identifier_field_entry;
+use base qw/metabib/;
+
+metabib::identifier_field_entry->table( 'metabib_identifier_field_entry' );
+metabib::identifier_field_entry->columns( Primary => qw/id/ );
+metabib::identifier_field_entry->columns( Essential => qw/field value source/ );
+
+
+#-------------------------------------------------------------------------------
package metabib::title_field_entry;
use base qw/metabib/;
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm 2010-05-18 16:53:33 UTC (rev 16447)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/CDBI.pm 2010-05-18 19:10:07 UTC (rev 16448)
@@ -538,6 +538,9 @@
metabib::title_field_entry->has_a( source => 'biblio::record_entry' );
metabib::title_field_entry->has_a( field => 'config::metabib_field' );
+
+ metabib::identifier_field_entry->has_a( source => 'biblio::record_entry' );
+ metabib::identifier_field_entry->has_a( field => 'config::metabib_field' );
metabib::author_field_entry->has_a( source => 'biblio::record_entry' );
metabib::author_field_entry->has_a( field => 'config::metabib_field' );
@@ -616,6 +619,7 @@
biblio::record_entry->has_many( call_numbers => 'asset::call_number' );
biblio::record_entry->has_many( full_record_entries => 'metabib::full_rec' );
biblio::record_entry->has_many( title_field_entries => 'metabib::title_field_entry' );
+ biblio::record_entry->has_many( identifier_field_entries => 'metabib::identifier_field_entry' );
biblio::record_entry->has_many( author_field_entries => 'metabib::author_field_entry' );
biblio::record_entry->has_many( subject_field_entries => 'metabib::subject_field_entry' );
biblio::record_entry->has_many( keyword_field_entries => 'metabib::keyword_field_entry' );
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm 2010-05-18 16:53:33 UTC (rev 16447)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Driver/Pg/dbi.pm 2010-05-18 19:10:07 UTC (rev 16448)
@@ -506,6 +506,15 @@
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------
+ package metabib::identifier_field_entry;
+
+ metabib::identifier_field_entry->table( 'metabib.identifier_field_entry' );
+ metabib::identifier_field_entry->sequence( 'metabib.identifier_field_entry_id_seq' );
+ metabib::identifier_field_entry->columns( 'FTS' => 'index_vector' );
+
+ #-------------------------------------------------------------------------------
+
+ #-------------------------------------------------------------------------------
package metabib::title_field_entry;
metabib::title_field_entry->table( 'metabib.title_field_entry' );
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/authority.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/authority.pm 2010-05-18 16:53:33 UTC (rev 16447)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/authority.pm 2010-05-18 19:10:07 UTC (rev 16448)
@@ -202,7 +202,7 @@
}
return undef;
}
-for my $class ( qw/title author subject keyword series/ ) {
+for my $class ( qw/title author subject keyword series identifier/ ) {
__PACKAGE__->register_method(
api_name => "open-ils.storage.authority.$class.see_from.controlled",
method => 'find_see_from_controlled',
@@ -233,7 +233,7 @@
}
return undef;
}
-for my $class ( qw/title author subject keyword series/ ) {
+for my $class ( qw/title author subject keyword series identifier/ ) {
__PACKAGE__->register_method(
api_name => "open-ils.storage.authority.$class.see_also_from.controlled",
method => 'find_see_also_from_controlled',
Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm 2010-05-18 16:53:33 UTC (rev 16447)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Storage/Publisher/metabib.pm 2010-05-18 19:10:07 UTC (rev 16448)
@@ -880,7 +880,7 @@
return undef;
}
-for my $class ( qw/title author subject keyword series/ ) {
+for my $class ( qw/title author subject keyword series identifier/ ) {
__PACKAGE__->register_method(
api_name => "open-ils.storage.metabib.$class.search_fts.metarecord",
method => 'search_class_fts',
@@ -1028,7 +1028,7 @@
return $recs;
}
-for my $class ( qw/title author subject keyword series/ ) {
+for my $class ( qw/title author subject keyword series identifier/ ) {
__PACKAGE__->register_method(
api_name => "open-ils.storage.metabib.$class.search_fts.metarecord_count",
method => 'search_class_fts_count',
@@ -1149,7 +1149,11 @@
my @fts_ranks = $fts->fts_rank;
my %bonus = ();
- $bonus{'metabib::keyword_field_entry'} = [ { 'CASE WHEN f.value ILIKE ? THEN 1.2 ELSE 1 END' => $SQLstring } ];
+ $bonus{'metabib::identifier_field_entry'} =
+ $bonus{'metabib::keyword_field_entry'} = [
+ { 'CASE WHEN f.value ILIKE ? THEN 1.2 ELSE 1 END' => $SQLstring }
+ ];
+
$bonus{'metabib::title_field_entry'} =
$bonus{'metabib::series_field_entry'} = [
{ 'CASE WHEN f.value ILIKE ? THEN 1.5 ELSE 1 END' => $first_word },
@@ -1397,7 +1401,7 @@
return undef;
}
-for my $class ( qw/title author subject keyword series/ ) {
+for my $class ( qw/title author subject keyword series identifier/ ) {
__PACKAGE__->register_method(
api_name => "open-ils.storage.metabib.$class.post_filter.search_fts.metarecord",
method => 'postfilter_search_class_fts',
@@ -1423,6 +1427,7 @@
subject => "metabib::subject_field_entry",
keyword => "metabib::keyword_field_entry",
series => "metabib::series_field_entry",
+ identifier => "metabib::identifier_field_entry",
};
# XXX factored most of the PG dependant stuff out of here... need to find a way to do "dependants".
Modified: trunk/Open-ILS/src/sql/Pg/030.schema.metabib.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/030.schema.metabib.sql 2010-05-18 16:53:33 UTC (rev 16447)
+++ trunk/Open-ILS/src/sql/Pg/030.schema.metabib.sql 2010-05-18 19:10:07 UTC (rev 16448)
@@ -29,6 +29,22 @@
CREATE INDEX metabib_metarecord_master_record_idx ON metabib.metarecord (master_record);
CREATE INDEX metabib_metarecord_fingerprint_idx ON metabib.metarecord (fingerprint);
+CREATE TABLE metabib.identifier_field_entry (
+ id BIGSERIAL PRIMARY KEY,
+ source BIGINT NOT NULL,
+ field INT NOT NULL,
+ value TEXT NOT NULL,
+ index_vector tsvector NOT NULL
+);
+CREATE TRIGGER metabib_identifier_field_entry_fti_trigger
+ BEFORE UPDATE OR INSERT ON metabib.identifier_field_entry
+ FOR EACH ROW EXECUTE PROCEDURE oils_tsearch2('keyword');
+
+CREATE INDEX metabib_identifier_field_entry_index_vector_idx ON metabib.identifier_field_entry USING GIST (index_vector);
+CREATE INDEX metabib_identifier_field_entry_value_idx ON metabib.identifier_field_entry (SUBSTRING(value,1,1024)) WHERE index_vector = ''::TSVECTOR;
+CREATE INDEX metabib_identifier_field_entry_source_idx ON metabib.identifier_field_entry (source);
+
+
CREATE TABLE metabib.title_field_entry (
id BIGSERIAL PRIMARY KEY,
source BIGINT NOT NULL,
Modified: trunk/Open-ILS/src/sql/Pg/800.fkeys.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/800.fkeys.sql 2010-05-18 16:53:33 UTC (rev 16447)
+++ trunk/Open-ILS/src/sql/Pg/800.fkeys.sql 2010-05-18 19:10:07 UTC (rev 16448)
@@ -54,6 +54,9 @@
ALTER TABLE metabib.title_field_entry ADD CONSTRAINT metabib_title_field_entry_source_pkey FOREIGN KEY (source) REFERENCES biblio.record_entry (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE metabib.title_field_entry ADD CONSTRAINT metabib_title_field_entry_field_pkey FOREIGN KEY (field) REFERENCES config.metabib_field (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE metabib.identifier_field_entry ADD CONSTRAINT metabib_identifier_field_entry_source_pkey FOREIGN KEY (source) REFERENCES biblio.record_entry (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE metabib.identifier_field_entry ADD CONSTRAINT metabib_identifier_field_entry_field_pkey FOREIGN KEY (field) REFERENCES config.metabib_field (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+
ALTER TABLE metabib.author_field_entry ADD CONSTRAINT metabib_author_field_entry_source_pkey FOREIGN KEY (source) REFERENCES biblio.record_entry (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE metabib.author_field_entry ADD CONSTRAINT metabib_author_field_entry_field_pkey FOREIGN KEY (field) REFERENCES config.metabib_field (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
@@ -63,6 +66,9 @@
ALTER TABLE metabib.keyword_field_entry ADD CONSTRAINT metabib_keyword_field_entry_source_pkey FOREIGN KEY (source) REFERENCES biblio.record_entry (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE metabib.keyword_field_entry ADD CONSTRAINT metabib_keyword_field_entry_field_pkey FOREIGN KEY (field) REFERENCES config.metabib_field (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE metabib.series_field_entry ADD CONSTRAINT metabib_series_field_entry_source_pkey FOREIGN KEY (source) REFERENCES biblio.record_entry (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE metabib.series_field_entry ADD CONSTRAINT metabib_series_field_entry_field_pkey FOREIGN KEY (field) REFERENCES config.metabib_field (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+
ALTER TABLE metabib.rec_descriptor ADD CONSTRAINT metabib_rec_descriptor_record_fkey FOREIGN KEY (record) REFERENCES biblio.record_entry (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
ALTER TABLE metabib.real_full_rec ADD CONSTRAINT metabib_full_rec_record_fkey FOREIGN KEY (record) REFERENCES biblio.record_entry (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2010-05-18 16:53:33 UTC (rev 16447)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql 2010-05-18 19:10:07 UTC (rev 16448)
@@ -11,6 +11,7 @@
INSERT INTO config.standing (id, value) VALUES (2, oils_i18n_gettext(2, 'Barred', 'cst', 'value'));
SELECT SETVAL('config.standing_id_seq'::TEXT, 100);
+INSERT INTO config.metabib_class ( name, label ) VALUES ( 'identifier', oils_i18n_gettext('identifier', 'Identifier', 'cmc', 'name') );
INSERT INTO config.metabib_class ( name, label ) VALUES ( 'keyword', oils_i18n_gettext('keyword', 'Keyword', 'cmc', 'name') );
INSERT INTO config.metabib_class ( name, label ) VALUES ( 'title', oils_i18n_gettext('title', 'Title', 'cmc', 'name') );
INSERT INTO config.metabib_class ( name, label ) VALUES ( 'author', oils_i18n_gettext('author', 'Author', 'cmc', 'name') );
@@ -54,17 +55,43 @@
(15, 'keyword', 'keyword', oils_i18n_gettext(15, 'General Keywords', 'cmf', 'label'), 'mods32', $$//mods32:mods/*[not(local-name()='originInfo')]$$ ); -- /* to fool vim */;
INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath ) VALUES
(16, 'subject', 'complete', oils_i18n_gettext(16, 'All Subjects', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:subject//text()$$ );
+
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (17, 'identifier', 'accession', oils_i18n_gettext(17, 'Accession Number', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="001"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (18, 'identifier', 'isbn', oils_i18n_gettext(18, 'ISBN', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="020"]/marcxml:subfield[code="a" or code="z"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (19, 'identifier', 'issn', oils_i18n_gettext(19, 'ISSN', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="022"]/marcxml:subfield[code="a" or code="z"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (20, 'identifier', 'upc', oils_i18n_gettext(20, 'UPC', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="024" and ind1="1"]/marcxml:subfield[code="a" or code="z"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (21, 'identifier', 'ismn', oils_i18n_gettext(21, 'ISMN', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="024" and ind1="2"]/marcxml:subfield[code="a" or code="z"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (22, 'identifier', 'ean', oils_i18n_gettext(22, 'EAN', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="024" and ind1="3"]/marcxml:subfield[code="a" or code="z"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (23, 'identifier', 'isrc', oils_i18n_gettext(23, 'ISRC', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="024" and ind1="0"]/marcxml:subfield[code="a" or code="z"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (24, 'identifier', 'sici', oils_i18n_gettext(24, 'SICI', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="024" and ind1="4"]/marcxml:subfield[code="a" or code="z"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (25, 'identifier', 'bibcn', oils_i18n_gettext(25, 'Local Free-Text Call Number', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="099"]//text()$$, TRUE );
+
SELECT SETVAL('config.metabib_field_id_seq'::TEXT, (SELECT MAX(id) FROM config.metabib_field), TRUE);
INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('kw','keyword');
INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('eg.keyword','keyword');
INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.publisher','keyword');
-INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.identifier','keyword');
INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('bib.subjecttitle','keyword');
INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('bib.genre','keyword');
INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('bib.edition','keyword');
INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('srw.serverchoice','keyword');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('id','identifier');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.identifier','identifier');
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('eg.isbn','identifier', 18);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('eg.issn','identifier', 19);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('eg.upc','identifier', 20);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('eg.callnumber','identifier', 25);
+
INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('au','author');
INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('name','author');
INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('creator','author');
Added: trunk/Open-ILS/src/sql/Pg/upgrade/0265.schema.identifier-search-class.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0265.schema.identifier-search-class.sql (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0265.schema.identifier-search-class.sql 2010-05-18 19:10:07 UTC (rev 16448)
@@ -0,0 +1,62 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0265'); -- miker
+
+ALTER TABLE config.metabib_field DROP CONSTRAINT metabib_field_field_class_check;
+
+INSERT INTO config.metabib_class ( name, label ) VALUES ( 'identifier', oils_i18n_gettext('identifier', 'Identifier', 'cmc', 'name') );
+
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (17, 'identifier', 'accession', oils_i18n_gettext(17, 'Accession Number', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="001"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (18, 'identifier', 'isbn', oils_i18n_gettext(18, 'ISBN', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="020"]/marcxml:subfield[code="a" or code="z"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (19, 'identifier', 'issn', oils_i18n_gettext(19, 'ISSN', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="022"]/marcxml:subfield[code="a" or code="z"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (20, 'identifier', 'upc', oils_i18n_gettext(20, 'UPC', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="024" and ind1="1"]/marcxml:subfield[code="a" or code="z"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (21, 'identifier', 'ismn', oils_i18n_gettext(21, 'ISMN', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="024" and ind1="2"]/marcxml:subfield[code="a" or code="z"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (22, 'identifier', 'ean', oils_i18n_gettext(22, 'EAN', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="024" and ind1="3"]/marcxml:subfield[code="a" or code="z"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (23, 'identifier', 'isrc', oils_i18n_gettext(23, 'ISRC', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="024" and ind1="0"]/marcxml:subfield[code="a" or code="z"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (24, 'identifier', 'sici', oils_i18n_gettext(24, 'SICI', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="024" and ind1="4"]/marcxml:subfield[code="a" or code="z"]/text()$$, TRUE );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field ) VALUES
+ (25, 'identifier', 'bibcn', oils_i18n_gettext(25, 'Local Free-Text Call Number', 'cmf', 'label'), 'marcxml', $$//marcxml:datafield[tag="099"]//text()$$, TRUE );
+
+SELECT SETVAL('config.metabib_field_id_seq'::TEXT, (SELECT MAX(id) FROM config.metabib_field), TRUE);
+
+
+DELETE FROM config.metabib_search_alias WHERE alias = 'dc.identifier';
+
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('id','identifier');
+INSERT INTO config.metabib_search_alias (alias,field_class) VALUES ('dc.identifier','identifier');
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('eg.isbn','identifier', 18);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('eg.issn','identifier', 19);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('eg.upc','identifier', 20);
+INSERT INTO config.metabib_search_alias (alias,field_class,field) VALUES ('eg.callnumber','identifier', 25);
+
+CREATE TABLE metabib.identifier_field_entry (
+ id BIGSERIAL PRIMARY KEY,
+ source BIGINT NOT NULL,
+ field INT NOT NULL,
+ value TEXT NOT NULL,
+ index_vector tsvector NOT NULL
+);
+CREATE TRIGGER metabib_identifier_field_entry_fti_trigger
+ BEFORE UPDATE OR INSERT ON metabib.identifier_field_entry
+ FOR EACH ROW EXECUTE PROCEDURE oils_tsearch2('keyword');
+
+CREATE INDEX metabib_identifier_field_entry_index_vector_idx ON metabib.identifier_field_entry USING GIST (index_vector);
+CREATE INDEX metabib_identifier_field_entry_value_idx ON metabib.identifier_field_entry
+ (SUBSTRING(value,1,1024)) WHERE index_vector = ''::TSVECTOR;
+CREATE INDEX metabib_identifier_field_entry_source_idx ON metabib.identifier_field_entry (source);
+
+ALTER TABLE metabib.identifier_field_entry ADD CONSTRAINT metabib_identifier_field_entry_source_pkey
+ FOREIGN KEY (source) REFERENCES biblio.record_entry (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+ALTER TABLE metabib.identifier_field_entry ADD CONSTRAINT metabib_identifier_field_entry_field_pkey
+ FOREIGN KEY (field) REFERENCES config.metabib_field (id) ON DELETE CASCADE DEFERRABLE INITIALLY DEFERRED;
+
+COMMIT;
+
More information about the open-ils-commits
mailing list