From ee754f3ab26214865e79c53f055ce7e530d1e714 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Fri, 22 Apr 2011 12:55:37 -0400 Subject: [PATCH] Secondary sort by quality ratio (higher means incoming is more "good" than existing) instead of simple incoming quality, which is a no-op (all the same) --- Open-ILS/src/sql/Pg/012.schema.vandelay.sql | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql index 8f1e2d6220..94a4f62d05 100644 --- a/Open-ILS/src/sql/Pg/012.schema.vandelay.sql +++ b/Open-ILS/src/sql/Pg/012.schema.vandelay.sql @@ -1312,7 +1312,10 @@ BEGIN WHERE m.queued_record = import_id AND r.id = m.eg_record 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; + ORDER BY m.match_score DESC, + m.quality::NUMERIC / COALESCE(NULLIF(vandelay.incoming_record_quality(r.marc),0),1)::NUMERIC DESC, + id + LIMIT 1; IF eg_id IS NULL THEN -- RAISE NOTICE 'incoming record is not of hight enough quality'; -- 2.11.0