LUCENE-4333: Fixed bug caused by previous commit.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1378568 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Martijn van Groningen 2012-08-29 14:07:31 +00:00
parent 660e880347
commit d447b1ae51
2 changed files with 22 additions and 18 deletions

View File

@ -244,9 +244,6 @@ public abstract class TermGroupFacetCollector extends AbstractGroupFacetCollecto
segmentTotalCount = 0;
segmentGroupedFacetHits.clear();
if (facetFieldDocTermOrds.isEmpty()) {
return;
}
for (GroupedFacetHit groupedFacetHit : groupedFacetHits) {
int groupOrd = groupFieldTermsIndex.binarySearchLookup(groupedFacetHit.groupValue, spare);
if (groupOrd < 0) {

View File

@ -239,6 +239,7 @@ public class GroupFacetCollectorTest extends AbstractGroupingTestCase {
addField(doc, "x", "x", useDv);
w.addDocument(doc);
// 1
doc = new Document();
addField(doc, groupField, "a", useDv);
addField(doc, "airport", "ams", useDv);
@ -247,28 +248,16 @@ public class GroupFacetCollectorTest extends AbstractGroupingTestCase {
w.commit();
w.deleteDocuments(new TermQuery(new Term("airport", "ams")));
// 0
doc = new Document();
addField(doc, groupField, "a", useDv);
addField(doc, "airport", "ams", useDv);
w.addDocument(doc);
// 1
doc = new Document();
addField(doc, groupField, "a", useDv);
addField(doc, "airport", "dus", useDv);
w.addDocument(doc);
// 2
doc = new Document();
addField(doc, groupField, "b", useDv);
addField(doc, groupField, "a", useDv);
addField(doc, "airport", "ams", useDv);
w.addDocument(doc);
// 3
doc = new Document();
addField(doc, groupField, "b", useDv);
addField(doc, "airport", "ams", useDv);
addField(doc, groupField, "a", useDv);
addField(doc, "airport", "dus", useDv);
w.addDocument(doc);
// 4
@ -277,7 +266,25 @@ public class GroupFacetCollectorTest extends AbstractGroupingTestCase {
addField(doc, "airport", "ams", useDv);
w.addDocument(doc);
// 5
doc = new Document();
addField(doc, groupField, "b", useDv);
addField(doc, "airport", "ams", useDv);
w.addDocument(doc);
// 6
doc = new Document();
addField(doc, groupField, "b", useDv);
addField(doc, "airport", "ams", useDv);
w.addDocument(doc);
w.commit();
// 7
doc = new Document();
addField(doc, "x", "x", useDv);
w.addDocument(doc);
w.commit();
w.close();
IndexSearcher indexSearcher = new IndexSearcher(DirectoryReader.open(dir));
AbstractGroupFacetCollector groupedAirportFacetCollector = createRandomCollector(groupField, "airport", null, true, useDv);