From 620096d1caaf27976a59e0dd5f492ff74eb71f57 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 22 Apr 2011 12:40:27 -0400 Subject: [PATCH] Revert thinko on single calc of bib record quality; store matchiness in a new match_score column --- Open-ILS/src/sql/Pg/012.schema.vandelay.sql | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql index 65f87c8df2..8f1e2d6220 100644 --- a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql +++ b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql @@ -715,10 +715,10 @@ BEGIN vandelay.match_set_test_marcxml(my_bib_queue.match_set, NEW.marc) LOOP INSERT INTO vandelay.bib_match ( - matched_set, queued_record, eg_record, quality + matched_set, queued_record, eg_record, match_score, quality ) VALUES ( my_bib_queue.match_set, NEW.id, test_result.record, - test_result.quality + test_result.quality, vandelay.incoming_record_quality(NEW.marc) ); END LOOP; @@ -1292,12 +1292,9 @@ CREATE OR REPLACE FUNCTION vandelay.auto_overlay_bib_record_with_best ( import_i DECLARE eg_id BIGINT; match_count INT; - existing_qual INT; match_attr vandelay.bib_attr_definition%ROWTYPE; BEGIN - existing_qual := COALESCE(NULLIF(vandelay.incoming_record_quality(r.marc),0),1); - IF lwm_ratio_value IS NULL THEN lwm_ratio_value := 0.0; END IF; @@ -1314,7 +1311,7 @@ BEGIN JOIN biblio.record_entry r WHERE m.queued_record = import_id AND r.id = m.eg_record - AND m.quality::NUMERIC / existing_qual::NUMERIC >= lwm_ratio_value + AND m.quality::NUMERIC / COALESCE(NULLIF(vandelay.incoming_record_quality(r.marc),0),1)::NUMERIC >= lwm_ratio_value ORDER BY m.match_score DESC, m.quality DESC, id limit 1; IF eg_id IS NULL THEN -- 2.11.0