https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=44191

            Bug ID: 44191
           Summary: Record matching ranks candidates by comparing scores
                    as text, so a lower-scoring record can be chosen for
                    overlay
   Initiative type: ---
        Sponsorship ---
            status:
           Product: Koha
           Version: Main
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P5 - low
         Component: MARC Bibliographic record staging/import
          Assignee: [email protected]
          Reporter: [email protected]
        QA Contact: [email protected]
  Target Milestone: ---

C4::Matcher::get_matches sorts the candidate records with a string comparison:

  @results = sort { $b->{'score'} cmp $a->{'score'} or $b->{'record_id'} cmp
$a->{'record_id'} } @results;

Scores are numbers, so as text "900" sorts above "1000" and "500" above "1000".
The import keeps the first max_matches results (1 when staging), so the record
that best matches the incoming one can be dropped and a weaker match chosen.
Committing the batch with "Replace existing record" then overlays the wrong
record.

Example with a rule that has two matchpoints, ISBN (score 1000) and title
(score 500), threshold 500: an incoming record whose ISBN matches record A and
whose title matches a different record B. A scores 1000 and B 500, but B is
reported as the match and overlaid.

The same applies to authority matching, and the record_id tie-break is also a
string comparison ("99" above "100").

To reproduce:
1. Administration > Record matching rules: a biblio rule with matchpoint 1 =
index isbn, tag 020 $a, score 1000, and matchpoint 2 = index title, tag 245 $a,
score 500; threshold 500.
2. Take two catalogue records A and B with different titles; A has an ISBN.
3. Stage a MARC file with one record that has A's ISBN and B's title, using
that rule.
4. Manage staged records: the match shown is B (score 500), not A (score 1000).

Or: prove t/db_dependent/Matcher.t with the subtest in the attached patch.

Reproduced on main (6ff8078).

-- 
You are receiving this mail because:
You are watching all bug changes.
You are the assignee for the bug.
_______________________________________________
Koha-bugs mailing list -- [email protected]
To unsubscribe send an email to [email protected]
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to