From ca359decc05131f82a7ebd4146c4acb68b7c4010 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Thu, 27 Mar 2014 14:19:34 -0400 Subject: [PATCH] LP#1259665 Split series browse config from search When we added browse support in 2.5, we took extra care to ensure that our series browse entries would sort and display reliably. 800t does not specify non-filing characters, so it was excluded from browse. Unfortunately, since browse and search had a single root config, this removed 800t from search as well. While we may want to reconsider expanding later on, this commit takes a conservative approach, and uses all series values for search and facets, but only entries with a usable filing indicator will be extracted for browse. It accomplishes this by splitting the series config in two, one config for search/faceting, and a second config dedicated to browse (similar to what was done for title). Signed-off-by: Dan Wells Signed-off-by: Ben Shum --- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 6 ++++-- .../XXXX.data.re-add_800_t_search_and_facets.sql | 25 ++++++++++++++++++++++ 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.data.re-add_800_t_search_and_facets.sql diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index e50d0bd026..ed31eff547 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -110,8 +110,8 @@ INSERT INTO config.xml_transform VALUES ( 'mods33', 'http://www.loc.gov/mods/v3' INSERT INTO config.xml_transform VALUES ( 'marc21expand880', 'http://www.loc.gov/MARC21/slim', 'marc', '' ); -- Index Definitions -INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field, authority_xpath, browse_sort_xpath ) VALUES - (1, 'series', 'seriestitle', oils_i18n_gettext(1, 'Series Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:relatedItem[@type="series"]/mods32:titleInfo[@type="nfi"]$$, TRUE, '//@xlink:href', $$*[local-name() != "nonSort"]$$ ); +INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_field, authority_xpath, browse_field ) VALUES + (1, 'series', 'seriestitle', oils_i18n_gettext(1, 'Series Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:relatedItem[@type="series"]/mods32:titleInfo[not(@type="nfi")]$$, TRUE, '//@xlink:href', FALSE ); INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, authority_xpath ) VALUES (2, 'title', 'abbreviated', oils_i18n_gettext(2, 'Abbreviated Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='abbreviated')]$$, '//@xlink:href' ); @@ -178,6 +178,8 @@ INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, (30, 'identifier', 'lccn', oils_i18n_gettext(30, 'LC Control Number', 'cmf', 'label'), 'marcxml', $$//marc:datafield[@tag='010']/marc:subfield[@code="a" or @code='z']$$, FALSE); INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, search_field, authority_xpath, browse_field, browse_sort_xpath ) VALUES (31, 'title', 'browse', oils_i18n_gettext(31, 'Title Proper (Browse)', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleBrowse$$, FALSE, '//@xlink:href', TRUE, $$*[local-name() != "nonSort"]$$ ); +INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, search_field, authority_xpath, browse_field, browse_sort_xpath ) VALUES + (32, 'series', 'browse', oils_i18n_gettext(32, 'Series Title (Browse)', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:relatedItem[@type="series"]/mods32:titleInfo[@type="nfi"]$$, FALSE, '//@xlink:href', TRUE, $$*[local-name() != "nonSort"]$$ ); UPDATE config.metabib_field SET joiner = ' -- ' WHERE field_class = 'subject' AND name NOT IN ('name', 'complete'); diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.re-add_800_t_search_and_facets.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.re-add_800_t_search_and_facets.sql new file mode 100644 index 0000000000..bef672f463 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.re-add_800_t_search_and_facets.sql @@ -0,0 +1,25 @@ +BEGIN; + +--SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +-- Don't use Series search field as the browse field +UPDATE config.metabib_field SET + browse_field = FALSE, + browse_xpath = NULL, + browse_sort_xpath = NULL, + xpath = $$//mods32:mods/mods32:relatedItem[@type="series"]/mods32:titleInfo[not(@type="nfi")]$$ +WHERE id = 1; + +-- Create a new series browse config +INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, search_field, authority_xpath, browse_field, browse_sort_xpath ) VALUES + (32, 'series', 'browse', oils_i18n_gettext(32, 'Series Title (Browse)', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:relatedItem[@type="series"]/mods32:titleInfo[@type="nfi"]$$, FALSE, '//@xlink:href', TRUE, $$*[local-name() != "nonSort"]$$ ); + +COMMIT; + +\qecho This is a full field-entry reingest of your bib records. +\qecho It will take a while. +\qecho You may cancel now without losing the effect of the rest of the +\qecho upgrade script, and arrange the reingest later. +\qecho . +SELECT COUNT(metabib.reingest_metabib_field_entries(id)) + FROM biblio.record_entry WHERE deleted IS FALSE; -- 2.11.0