From: Mike Rylander Date: Wed, 20 Oct 2021 20:22:37 +0000 (-0400) Subject: LP#1947173: Clean up bad cataloging pot hole X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=2d0a459eaca7d4a6613c4a5b3f40fe8b3481673e;p=evergreen%2Fmasslnc.git LP#1947173: Clean up bad cataloging pot hole If a MARC record has effectively empty fields (all space or punctuation) then it's possible to stumble over a NULL text array when parsing content for the symspell dictionary. This commit checks for that condition and returns early to avoid the problem. Signed-off-by: Mike Rylander Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql index d06c56b9d6..dcdb5af5db 100644 --- a/Open-ILS/src/sql/Pg/300.schema.staged_search.sql +++ b/Open-ILS/src/sql/Pg/300.schema.staged_search.sql @@ -1971,6 +1971,9 @@ BEGIN input := evergreen.lowercase(full_input); word_list := ARRAY_AGG(x) FROM search.symspell_parse_words_distinct(input) x; + IF word_list IS NULL THEN + RETURN; + END IF; IF CARDINALITY(word_list) > 1 AND include_phrases THEN RETURN QUERY SELECT * FROM search.symspell_build_raw_entry(input, source_class, TRUE, prefix_length, maxED); diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.symspell-speed-ingest.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.symspell-speed-ingest.sql index 150135794e..e0e660fea7 100644 --- a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.symspell-speed-ingest.sql +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.symspell-speed-ingest.sql @@ -135,6 +135,9 @@ BEGIN input := evergreen.lowercase(full_input); word_list := ARRAY_AGG(x) FROM search.symspell_parse_words_distinct(input) x; + IF word_list IS NULL THEN + RETURN; + END IF; IF CARDINALITY(word_list) > 1 AND include_phrases THEN RETURN QUERY SELECT * FROM search.symspell_build_raw_entry(input, source_class, TRUE, prefix_length, maxED);