From 2f9c80ae6b6a3a8ed1f7d2b91f310a6faf1d69fa Mon Sep 17 00:00:00 2001 From: Bob Wicksall Date: Thu, 13 Jun 2013 01:06:10 -0400 Subject: [PATCH] Reduce index bloat involving non-search_field values Rows in metabib.title_field_entry, subject_field_entry, series_field_entry, and author_field_entry are doubled or tripled due to bad logic in biblio.extract_metabib_field_entry. This results in these tables being 2 or more times their correct size. This was introduced in 2.2.0 when the logic for browse_field and facet_field were added to biblio.extract_metabib_field_entry. 2.1 is not affected. The duplicates are caused when biblio.extract_metabib_field_entry returns TRUE in the search_field column for all rows even if they should just be facet_field or browse_field after the first search_field value is returned. Signed-off-by: Mike Rylander Signed-off-by: Dan Scott --- Open-ILS/src/sql/Pg/030.schema.metabib.sql | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Open-ILS/src/sql/Pg/030.schema.metabib.sql b/Open-ILS/src/sql/Pg/030.schema.metabib.sql index e14c239678..a047e1e48f 100644 --- a/Open-ILS/src/sql/Pg/030.schema.metabib.sql +++ b/Open-ILS/src/sql/Pg/030.schema.metabib.sql @@ -411,6 +411,11 @@ DECLARE output_row metabib.field_entry_template%ROWTYPE; BEGIN + -- Start out with no field-use bools set + output_row.browse_field = FALSE; + output_row.facet_field = FALSE; + output_row.search_field = FALSE; + -- Get the record SELECT INTO bib * FROM biblio.record_entry WHERE id = rid; @@ -513,6 +518,7 @@ BEGIN output_row.search_field = TRUE; RETURN NEXT output_row; + output_row.search_field = FALSE; END IF; END LOOP; -- 2.43.2