From 0f91b38fae5a53fbedf2bf438a931a6eaa801278 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Sat, 4 Jun 2011 13:58:37 +0000 Subject: [PATCH] LUCENE-3129: fix false TestGrouping failure git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1131401 13f79535-47bb-0310-9956-ffa450edef68 --- .../lucene/search/grouping/TestGrouping.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java b/modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java index 2a4bcbcec61..89a9ecb9329 100644 --- a/modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java +++ b/modules/grouping/src/test/org/apache/lucene/search/grouping/TestGrouping.java @@ -554,11 +554,15 @@ public class TestGrouping extends LuceneTestCase { // Reader2 only increases maxDoc() vs reader, which // means a monotonic shift in scores, so we can // reliably remap them w/ Map: - final Map scoreMap = new HashMap(); + final Map> scoreMap = new HashMap>(); // Tricky: must separately set .score2, because the doc // block index was created with possible deletions! + //System.out.println("fixup score2"); for(int contentID=0;contentID<3;contentID++) { + //System.out.println(" term=real" + contentID); + final Map termScoreMap = new HashMap(); + scoreMap.put("real"+contentID, termScoreMap); //System.out.println("term=real" + contentID + " dfold=" + s.docFreq(new Term("content", "real"+contentID)) + //" dfnew=" + s2.docFreq(new Term("content", "real"+contentID))); final ScoreDoc[] hits = s2.search(new TermQuery(new Term("content", "real"+contentID)), numDocs).scoreDocs; @@ -567,8 +571,8 @@ public class TestGrouping extends LuceneTestCase { assertTrue(gd.score2 == 0.0); gd.score2 = hit.score; assertEquals(gd.id, docIDToID2[hit.doc]); - //System.out.println(" score=" + hit.score + " id=" + docIDToID2[hit.doc]); - scoreMap.put(gd.score, gd.score2); + //System.out.println(" score=" + gd.score + " score2=" + hit.score + " id=" + docIDToID2[hit.doc]); + termScoreMap.put(gd.score, gd.score2); } } @@ -766,11 +770,13 @@ public class TestGrouping extends LuceneTestCase { } final SortField[] sortFields = groupSort.getSort(); + final Map termScoreMap = scoreMap.get(searchTerm); for(int groupSortIDX=0;groupSortIDX