From 51d875e9b5714529e774f72764d058cdb1a32bc2 Mon Sep 17 00:00:00 2001 From: miker Date: Fri, 21 May 2010 15:46:30 +0000 Subject: [PATCH] add identifier FTS config (assumed to exist in some places) git-svn-id: svn://svn.open-ils.org/ILS/trunk@16473 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../src/sql/Pg/000.english.pg81.fts-config.sql | 21 ++++++++++++ .../src/sql/Pg/000.english.pg82.fts-config.sql | 21 ++++++++++++ .../src/sql/Pg/000.english.pg83.fts-config.sql | 1 + .../src/sql/Pg/000.english.pg84.fts-config.sql | 1 + Open-ILS/src/sql/Pg/002.schema.config.sql | 2 +- .../upgrade/0272.schema.identifier-fts-config.sql | 37 ++++++++++++++++++++++ 6 files changed, 82 insertions(+), 1 deletion(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0272.schema.identifier-fts-config.sql diff --git a/Open-ILS/src/sql/Pg/000.english.pg81.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg81.fts-config.sql index 1ea4ac935..650005e1a 100644 --- a/Open-ILS/src/sql/Pg/000.english.pg81.fts-config.sql +++ b/Open-ILS/src/sql/Pg/000.english.pg81.fts-config.sql @@ -29,6 +29,7 @@ INSERT INTO pg_ts_cfg VALUES ('title', 'default','C'); INSERT INTO pg_ts_cfg VALUES ('author', 'default','C'); INSERT INTO pg_ts_cfg VALUES ('subject', 'default','C'); INSERT INTO pg_ts_cfg VALUES ('keyword', 'default','C'); +INSERT INTO pg_ts_cfg VALUES ('identifier', 'default','C'); INSERT INTO pg_ts_cfg VALUES ('series', 'default','C'); INSERT INTO pg_ts_dict VALUES ('en_stem_nostop', 'snb_en_init(internal)', '', 'snb_lexize(internal,internal,integer)', 'English Stemmer. Snowball. No stop words.'); @@ -93,6 +94,26 @@ INSERT INTO pg_ts_cfgmap VALUES ('subject', 'lword', '{en_stem_nostop}'); INSERT INTO pg_ts_cfgmap VALUES ('subject', 'lpart_hword', '{en_stem_nostop}'); INSERT INTO pg_ts_cfgmap VALUES ('subject', 'lhword', '{en_stem_nostop}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'nlword', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'word', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'email', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'url', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'host', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'sfloat', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'version', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'part_hword', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'nlpart_hword', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'hword', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'nlhword', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'uri', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'file', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'float', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'int', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'uint', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'lword', '{en_stem_nostop}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'lpart_hword', '{en_stem_nostop}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'lhword', '{en_stem_nostop}'); + INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'nlword', '{simple}'); INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'word', '{simple}'); INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'email', '{simple}'); diff --git a/Open-ILS/src/sql/Pg/000.english.pg82.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg82.fts-config.sql index 1ea4ac935..650005e1a 100644 --- a/Open-ILS/src/sql/Pg/000.english.pg82.fts-config.sql +++ b/Open-ILS/src/sql/Pg/000.english.pg82.fts-config.sql @@ -29,6 +29,7 @@ INSERT INTO pg_ts_cfg VALUES ('title', 'default','C'); INSERT INTO pg_ts_cfg VALUES ('author', 'default','C'); INSERT INTO pg_ts_cfg VALUES ('subject', 'default','C'); INSERT INTO pg_ts_cfg VALUES ('keyword', 'default','C'); +INSERT INTO pg_ts_cfg VALUES ('identifier', 'default','C'); INSERT INTO pg_ts_cfg VALUES ('series', 'default','C'); INSERT INTO pg_ts_dict VALUES ('en_stem_nostop', 'snb_en_init(internal)', '', 'snb_lexize(internal,internal,integer)', 'English Stemmer. Snowball. No stop words.'); @@ -93,6 +94,26 @@ INSERT INTO pg_ts_cfgmap VALUES ('subject', 'lword', '{en_stem_nostop}'); INSERT INTO pg_ts_cfgmap VALUES ('subject', 'lpart_hword', '{en_stem_nostop}'); INSERT INTO pg_ts_cfgmap VALUES ('subject', 'lhword', '{en_stem_nostop}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'nlword', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'word', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'email', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'url', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'host', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'sfloat', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'version', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'part_hword', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'nlpart_hword', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'hword', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'nlhword', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'uri', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'file', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'float', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'int', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'uint', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'lword', '{en_stem_nostop}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'lpart_hword', '{en_stem_nostop}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'lhword', '{en_stem_nostop}'); + INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'nlword', '{simple}'); INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'word', '{simple}'); INSERT INTO pg_ts_cfgmap VALUES ('keyword', 'email', '{simple}'); diff --git a/Open-ILS/src/sql/Pg/000.english.pg83.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg83.fts-config.sql index b089f7794..b0b115751 100644 --- a/Open-ILS/src/sql/Pg/000.english.pg83.fts-config.sql +++ b/Open-ILS/src/sql/Pg/000.english.pg83.fts-config.sql @@ -36,6 +36,7 @@ ALTER TEXT SEARCH CONFIGURATION title ALTER MAPPING FOR asciiword, asciihword, h CREATE TEXT SEARCH CONFIGURATION author ( COPY = title ); CREATE TEXT SEARCH CONFIGURATION subject ( COPY = title ); CREATE TEXT SEARCH CONFIGURATION keyword ( COPY = title ); +CREATE TEXT SEARCH CONFIGURATION identifier ( COPY = title ); CREATE TEXT SEARCH CONFIGURATION series ( COPY = title ); CREATE TEXT SEARCH CONFIGURATION "default" ( COPY = title ); diff --git a/Open-ILS/src/sql/Pg/000.english.pg84.fts-config.sql b/Open-ILS/src/sql/Pg/000.english.pg84.fts-config.sql index b089f7794..b0b115751 100644 --- a/Open-ILS/src/sql/Pg/000.english.pg84.fts-config.sql +++ b/Open-ILS/src/sql/Pg/000.english.pg84.fts-config.sql @@ -36,6 +36,7 @@ ALTER TEXT SEARCH CONFIGURATION title ALTER MAPPING FOR asciiword, asciihword, h CREATE TEXT SEARCH CONFIGURATION author ( COPY = title ); CREATE TEXT SEARCH CONFIGURATION subject ( COPY = title ); CREATE TEXT SEARCH CONFIGURATION keyword ( COPY = title ); +CREATE TEXT SEARCH CONFIGURATION identifier ( COPY = title ); CREATE TEXT SEARCH CONFIGURATION series ( COPY = title ); CREATE TEXT SEARCH CONFIGURATION "default" ( COPY = title ); diff --git a/Open-ILS/src/sql/Pg/002.schema.config.sql b/Open-ILS/src/sql/Pg/002.schema.config.sql index 919120040..2f0a5def7 100644 --- a/Open-ILS/src/sql/Pg/002.schema.config.sql +++ b/Open-ILS/src/sql/Pg/002.schema.config.sql @@ -65,7 +65,7 @@ CREATE TABLE config.upgrade_log ( install_date TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW() ); -INSERT INTO config.upgrade_log (version) VALUES ('0271'); -- miker +INSERT INTO config.upgrade_log (version) VALUES ('0272'); -- miker CREATE TABLE config.bib_source ( id SERIAL PRIMARY KEY, diff --git a/Open-ILS/src/sql/Pg/upgrade/0272.schema.identifier-fts-config.sql b/Open-ILS/src/sql/Pg/upgrade/0272.schema.identifier-fts-config.sql new file mode 100644 index 000000000..e584be1f7 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0272.schema.identifier-fts-config.sql @@ -0,0 +1,37 @@ + +-- No transaction, because any or all of these can fail. Expect errors! + +INSERT INTO config.upgrade_log (version) VALUES ('0272'); -- miker + +DROP TRIGGER metabib_identifier_field_entry_fti_trigger ON metabib.identifier_field_entry; + +-- 8.3 and beyond +CREATE TEXT SEARCH CONFIGURATION identifier ( COPY = title ); + +-- 8.2 and before +INSERT INTO pg_ts_cfg VALUES ('identifier', 'default','C'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'nlword', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'word', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'email', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'url', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'host', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'sfloat', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'version', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'part_hword', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'nlpart_hword', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'hword', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'nlhword', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'uri', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'file', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'float', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'int', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'uint', '{simple}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'lword', '{en_stem_nostop}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'lpart_hword', '{en_stem_nostop}'); +INSERT INTO pg_ts_cfgmap VALUES ('identifier', 'lhword', '{en_stem_nostop}'); + + +CREATE TRIGGER metabib_identifier_field_entry_fti_trigger + BEFORE UPDATE OR INSERT ON metabib.identifier_field_entry + FOR EACH ROW EXECUTE PROCEDURE oils_tsearch2('identifier'); + -- 2.11.0