Repository: lucy Updated Branches: refs/heads/mingw-fixes 7ac897cc3 -> 3b1945e02
Fix intermittent test-only sort order bug. Lucy breaks ties by doc_id, but the test did not. The bug only manifested once every few hundred iterations because the collisions between scores occurred rarely. Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/6ea4ea2c Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/6ea4ea2c Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/6ea4ea2c Branch: refs/heads/mingw-fixes Commit: 6ea4ea2c483ac41c7c62a3fda979f3393a8355ba Parents: 7ac897c Author: Marvin Humphrey <[email protected]> Authored: Tue Jul 22 00:50:05 2014 +0000 Committer: Marvin Humphrey <[email protected]> Committed: Tue Jul 22 00:50:05 2014 +0000 ---------------------------------------------------------------------- perl/t/505-hit_queue.t | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/6ea4ea2c/perl/t/505-hit_queue.t ---------------------------------------------------------------------- diff --git a/perl/t/505-hit_queue.t b/perl/t/505-hit_queue.t index ed4d7a9..002a749 100644 --- a/perl/t/505-hit_queue.t +++ b/perl/t/505-hit_queue.t @@ -187,8 +187,9 @@ is_deeply( \@got, \@wanted, "sort by value when no reader set" ); for ( 1 .. 30 ) { push @docs_and_scores, [ int( rand(10000) ) + 1, rand(10) ]; } -@docs_and_scores = sort { $b->[1] <=> $a->[1] } @docs_and_scores; -@doc_ids = map { $_->[0] } @docs_and_scores; +@docs_and_scores + = sort { $b->[1] <=> $a->[1] || $a->[0] <=> $b->[0] } @docs_and_scores; +@doc_ids = map { $_->[0] } @docs_and_scores; @match_docs = map { Lucy::Search::MatchDoc->new(
