From 844facb811f1f14c2cb4c91970fdbaaff00628a0 Mon Sep 17 00:00:00 2001 From: Dan Wells Date: Wed, 9 Oct 2013 13:46:55 -0400 Subject: [PATCH] Don't index browse extracts as search terms unless needed In previous releases, we didn't have any major config.metabib_field rows which had 'browse_field = true' but 'search_field = false'. Now that we have one (for title browse), make sure we honor the 'search_field = false' by not creating rows in the metabib.xxxxxx_field_entry tables. This gets us back to where we started as far as what gets into the search index tables, but we should consider going a step further and *not* adding the glommed row to the search tables if we are already adding separate rows for search+browse. Signed-off-by: Dan Wells Signed-off-by: Lebbeous Fogle-Weekley --- Open-ILS/src/sql/Pg/030.schema.metabib.sql | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/sql/Pg/030.schema.metabib.sql b/Open-ILS/src/sql/Pg/030.schema.metabib.sql index a0ae451b1d..80768283b1 100644 --- a/Open-ILS/src/sql/Pg/030.schema.metabib.sql +++ b/Open-ILS/src/sql/Pg/030.schema.metabib.sql @@ -543,8 +543,16 @@ BEGIN END IF; output_row.browse_field = TRUE; + -- Returning browse rows with search_field = true for search+browse + -- configs allows us to retain granularity of being able to search + -- browse fields with "starts with" type operators (for example, for + -- titles of songs in music albums) + IF idx.search_field THEN + output_row.search_field = TRUE; + END IF; RETURN NEXT output_row; output_row.browse_field = FALSE; + output_row.search_field = FALSE; output_row.sort_value := NULL; END IF; @@ -710,10 +718,8 @@ BEGIN VALUES (mbe_id, ind_data.field, ind_data.source, ind_data.authority); END IF; - -- Avoid inserting duplicate rows, but retain granularity of being - -- able to search browse fields with "starts with" type operators - -- (for example, for titles of songs in music albums) - IF (ind_data.search_field OR ind_data.browse_field) AND NOT b_skip_search THEN + IF ind_data.search_field AND NOT b_skip_search THEN + -- Avoid inserting duplicate rows EXECUTE 'SELECT 1 FROM metabib.' || ind_data.field_class || '_field_entry WHERE field = $1 AND source = $2 AND value = $3' INTO mbe_id USING ind_data.field, ind_data.source, ind_data.value; -- 2.43.2