From: Bill Erickson Date: Thu, 16 May 2019 18:53:38 +0000 (+0000) Subject: JBAS-2284 Identifier (call number) browse respects '.' chars X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=92db9e4d39815ea487ba4fc7be8c731d7dd1d81a;p=working%2FEvergreen.git JBAS-2284 Identifier (call number) browse respects '.' chars When performing an identifier browse, avoid stripping '.' characters from the sort value when locating the browse pivot. Signed-off-by: Bill Erickson --- diff --git a/KCLS/sql/schema/deploy/3.2-additions.sql b/KCLS/sql/schema/deploy/3.2-additions.sql index d7e25e543a..dfd70086d7 100644 --- a/KCLS/sql/schema/deploy/3.2-additions.sql +++ b/KCLS/sql/schema/deploy/3.2-additions.sql @@ -3,6 +3,33 @@ BEGIN; +CREATE OR REPLACE FUNCTION metabib.browse_pivot( + search_field INT[], browse_term TEXT +) RETURNS BIGINT AS $p$ +-- handles 'search_field' conflict. using this means I don't +-- have to drop/recreate the function and those that rely on it +-- just to change the 'search_field' param name. +#variable_conflict use_variable +DECLARE + sort_value TEXT; +BEGIN + SELECT INTO sort_value + CASE WHEN cmf.field_class = 'identifier' THEN + public.naco_normalize_keep_decimal($2, '') + ELSE + public.naco_normalize($2) + END + FROM config.metabib_field cmf + WHERE cmf.id = search_field[1]; + + RETURN id FROM metabib.browse_entry + WHERE metabib_fields_cache && $1 + AND combo_sort_value >= sort_value + ORDER BY combo_sort_value LIMIT 1; +END; +$p$ LANGUAGE PLPGSQL STABLE; + + DO $INSERT$ BEGIN IF evergreen.insert_on_deploy() THEN