[Koha-bugs] [Bug 17710] New: C4::Matcher::get_matches and C4::ImportBatch:: GetBestRecordMatch should use same logic
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Fri Dec 2 04:35:55 CET 2016
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17710
Bug ID: 17710
Summary: C4::Matcher::get_matches and
C4::ImportBatch::GetBestRecordMatch should use same
logic
Change sponsored?: ---
Product: Koha
Version: master
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P5 - low
Component: MARC Bibliographic record staging/import
Assignee: gmcharlt at gmail.com
Reporter: dcook at prosentient.com.au
QA Contact: testopia at bugs.koha-community.org
C4::Matcher::get_matches sorts its rows in descending order using score, while
C4::ImportBatch::GetBestRecordMatch sorts its rows in descending order using
score and record id.
To get the best record match, C4::ImportBatch::GetBestRecordMatch takes the top
result.
By contrast, C4::Matcher::get_matches could easily return different rows in the
top position if there are multiple rows with the same score, since its array is
populated using a hash where order doesn't matter.
It's an easy enough fix, although I will admit to finding the solution on
StackOverflow:
"Since <=> and cmp return 0 to indicate equality, and that's false, and because
Perl's logical Boolean operators return the deciding value instead of just 0 or
1, sorting by multiple keys is as easy as stringing multiple comparisons
together with or or ||"
http://stackoverflow.com/questions/10395383/sorting-an-array-of-hash-by-multiple-keys-perl
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list