Don't index browse extracts as search terms unless needed
authorDan Wells <dbw2@calvin.edu>
Wed, 9 Oct 2013 17:46:55 +0000 (13:46 -0400)
committerDan Wells <dbw2@calvin.edu>
Thu, 10 Oct 2013 21:11:12 +0000 (17:11 -0400)
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 <dbw2@calvin.edu>
Signed-off-by: Lebbeous Fogle-Weekley <lebbeous@esilibrary.com>
Open-ILS/src/sql/Pg/030.schema.metabib.sql

index a0ae451..8076828 100644 (file)
@@ -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;