You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by ma...@apache.org on 2014/07/22 03:00:53 UTC

[1/2] git commit: refs/heads/mingw-fixes - Fix intermittent test-only sort order bug.

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 <ma...@rectangular.com>
Authored: Tue Jul 22 00:50:05 2014 +0000
Committer: Marvin Humphrey <ma...@rectangular.com>
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(


[2/2] git commit: refs/heads/mingw-fixes - Increase randomness of HitQueue test.

Posted by ma...@apache.org.
Increase randomness of HitQueue test.

Insert docs into HitQueue in random order to stress the heap sort, even
though they will be inserted in doc_id order in current Lucy.


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/3b1945e0
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/3b1945e0
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/3b1945e0

Branch: refs/heads/mingw-fixes
Commit: 3b1945e02031116de2d4cebdc6fa67ef2f0aaa59
Parents: 6ea4ea2
Author: Marvin Humphrey <ma...@rectangular.com>
Authored: Tue Jul 22 00:58:29 2014 +0000
Committer: Marvin Humphrey <ma...@rectangular.com>
Committed: Tue Jul 22 00:58:29 2014 +0000

----------------------------------------------------------------------
 perl/t/505-hit_queue.t | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/3b1945e0/perl/t/505-hit_queue.t
----------------------------------------------------------------------
diff --git a/perl/t/505-hit_queue.t b/perl/t/505-hit_queue.t
index 002a749..31acaa7 100644
--- a/perl/t/505-hit_queue.t
+++ b/perl/t/505-hit_queue.t
@@ -36,7 +36,7 @@ my @match_docs = map {
         doc_id => $_->[0],
         score  => $_->[1],
         )
-} @docs_and_scores;
+} shuffle(@docs_and_scores);
 
 my @correct_order = sort {
            $b->get_score <=> $a->get_score
@@ -196,7 +196,7 @@ for ( 1 .. 30 ) {
         doc_id => $_->[0],
         score  => $_->[1],
         )
-} sort { $a->[0] <=> $b->[0] } @docs_and_scores;
+} shuffle(@docs_and_scores);
 
 for my $size ( 0 .. $#match_docs ) {
     $hit_q = Lucy::Search::HitQueue->new( wanted => $size, );