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;
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;
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