Two bugfixes to OPAC Browse: non-filing indicators, leading-article warning
authorLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 8 May 2013 19:09:06 +0000 (15:09 -0400)
committerLebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Wed, 8 May 2013 19:09:06 +0000 (15:09 -0400)
The second upgrade script in this branch now changes your metabib field
definitions so that browse headings respect non-filing indicators (it
does not perform the re-ingest for you).

There is also a fix to the mod_perl layer driving OPAC display, so that
now the config.global_flag value for warning about leading articles can
actually be inert as intended when enabled=f.

Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Browse.pm
Open-ILS/src/sql/Pg/030.schema.metabib.sql
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/YYYY.schema.bib-auth-browse.sql

index 059bad1..df3f86c 100644 (file)
@@ -262,7 +262,7 @@ sub leading_article_test {
     my $flag_name = "opac.browse.warnable_regexp_per_class";
     my $flag = $self->ctx->{get_cgf}->($flag_name);
 
-    return unless $flag->enabled;
+    return unless $flag->enabled eq 't';
 
     my $map;
 
index fd32f3d..e6caa0a 100644 (file)
@@ -554,6 +554,7 @@ BEGIN
 
             output_row.search_field = TRUE;
             RETURN NEXT output_row;
+            output_row.search_field = FALSE;
         END IF;
 
     END LOOP;
index d96528f..119d76c 100644 (file)
@@ -119,8 +119,8 @@ INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath,
     (4, 'title', 'alternative', oils_i18n_gettext(4, 'Alternate Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='alternative')]$$, '//@xlink:href' );
 INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, authority_xpath ) VALUES 
     (5, 'title', 'uniform', oils_i18n_gettext(5, 'Uniform Title', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleInfo[mods32:title and (@type='uniform')]$$, '//@xlink:href' );
-INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, authority_xpath ) VALUES 
-    (6, 'title', 'proper', oils_i18n_gettext(6, 'Title Proper', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleNonfiling[mods32:title and not (@type)]$$, '//@xlink:href' );
+INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, authority_xpath, browse_field ) VALUES 
+    (6, 'title', 'proper', oils_i18n_gettext(6, 'Title Proper', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:titleNonfiling[mods32:title and not (@type)]$$, '//@xlink:href', FALSE );
 
 INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, facet_xpath, facet_field , authority_xpath) VALUES 
     (7, 'author', 'corporate', oils_i18n_gettext(7, 'Corporate Author', 'cmf', 'label'), 'mods32', $$//mods32:mods/mods32:name[@type='corporate' and (mods32:role/mods32:roleTerm[text()='creator'] or mods32:role/mods32:roleTerm[text()='aut'] or mods32:role/mods32:roleTerm[text()='cre'])]$$, $$//*[local-name()='namePart']$$, TRUE, '//@xlink:href' ); -- /* to fool vim */;
@@ -174,6 +174,9 @@ INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath,
     (29, 'identifier', 'scn', oils_i18n_gettext(29, 'System Control Number', 'cmf', 'label'), 'marcxml', $$//marc:datafield[@tag='035']/marc:subfield[@code="a"]$$, FALSE);
 INSERT INTO config.metabib_field ( id, field_class, name, label, format, xpath, browse_field) VALUES
     (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, xpath, format, search_field, facet_field, browse_field) VALUES
+    (31, 'title', 'browse', oils_i18n_gettext(31, 'Title Proper (Browse)', 'cmf', 'label'), $$//mods32:mods/mods32:titleInfo[not (@type)]/mods32:title$$, 'mods32', FALSE, FALSE, TRUE);
+
 
 SELECT SETVAL('config.metabib_field_id_seq'::TEXT, (SELECT MAX(id) FROM config.metabib_field), TRUE);
 
index 7669d93..ad4a4a5 100644 (file)
@@ -7,6 +7,15 @@ ALTER TABLE metabib.browse_entry_def_map ADD COLUMN authority BIGINT REFERENCES
 
 ALTER TABLE config.metabib_field ADD COLUMN authority_xpath TEXT;
 
+-- The following UPDATE also affects AutoSuggest, but not in a way users
+-- are likely to find objectionable.  The selection of suggestions based
+-- on user input shouldn't change, but the displayed heading will no longer
+-- show leading articles or similar that can be rubbed out by non-filing
+-- indicators.
+change
+UPDATE config.metabib_field SET browse_field = FALSE
+    WHERE field_class = 'title' and name = 'proper';
+
 UPDATE config.metabib_field
     SET authority_xpath = '//@xlink:href'
     WHERE
@@ -14,6 +23,16 @@ UPDATE config.metabib_field
         field_class IN ('subject','series','title','author') AND
         browse_field IS TRUE;
 
+INSERT INTO config.metabib_field (
+    id, field_class, name, label, xpath, format,
+    search_field, facet_field, browse_field
+) VALUES (
+    31, 'title', 'browse',
+    oils_i18n_gettext(31, 'Title Proper (Browse)', 'cmf', 'label'),
+    $$//mods32:mods/mods32:titleInfo[not (@type)]/mods32:title$$,
+    'mods32', FALSE, FALSE, TRUE
+);
+
 ALTER TYPE metabib.field_entry_template ADD ATTRIBUTE authority BIGINT;
 
 
@@ -240,6 +259,7 @@ BEGIN
 
             output_row.search_field = TRUE;
             RETURN NEXT output_row;
+            output_row.search_field = FALSE;
         END IF;
 
     END LOOP;
@@ -6882,7 +6902,7 @@ Revision 1.2 - Added Log Comment  2003/03/24 19:37:42  ckeith
 </xsl:stylesheet>$$ WHERE name = 'mods33';
 
 
-INSERT INTO config.global_flag (name, value, enabled, label) 
+INSERT INTO config.global_flag (name, value, enabled, label)
 VALUES (
     'opac.browse.warnable_regexp_per_class',
     '{"title": "^(a|the|an)\\s"}',