Fixed build failure related to LUCENE-4333 changes.

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1382610 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Martijn van Groningen 2012-09-09 23:50:28 +00:00
parent d74cb2ce43
commit 926277b304
2 changed files with 15 additions and 2 deletions

View File

@ -186,11 +186,23 @@ public abstract class TermGroupFacetCollector extends AbstractGroupFacetCollecto
}
public void collect(int doc) throws IOException {
int groupOrd = groupFieldTermsIndex.getOrd(doc);
if (facetFieldDocTermOrds.isEmpty()) {
int segmentGroupedFacetsIndex = groupOrd * (facetFieldDocTermOrds.numTerms() + 1);
if (facetPrefix != null || segmentGroupedFacetHits.exists(segmentGroupedFacetsIndex)) {
return;
}
segmentTotalCount++;
segmentFacetCounts[facetFieldDocTermOrds.numTerms()]++;
segmentGroupedFacetHits.put(segmentGroupedFacetsIndex);
groupedFacetHits.add(
new GroupedFacetHit(groupOrd == 0 ? null : groupFieldTermsIndex.lookup(groupOrd, new BytesRef()), null)
);
return;
}
int groupOrd = groupFieldTermsIndex.getOrd(doc);
if (facetOrdTermsEnum != null) {
reuse = facetFieldDocTermOrds.lookup(doc, reuse);
}

View File

@ -30,6 +30,7 @@ import org.apache.lucene.search.TermQuery;
import org.apache.lucene.search.grouping.dv.DVGroupFacetCollector;
import org.apache.lucene.search.grouping.term.TermGroupFacetCollector;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util._TestUtil;
@ -291,7 +292,7 @@ public class GroupFacetCollectorTest extends AbstractGroupingTestCase {
indexSearcher.search(new MatchAllDocsQuery(), groupedAirportFacetCollector);
TermGroupFacetCollector.GroupedFacetResult airportResult = groupedAirportFacetCollector.mergeSegmentResults(10, 0, false);
assertEquals(3, airportResult.getTotalCount());
assertEquals(0, airportResult.getTotalMissingCount());
assertEquals(1, airportResult.getTotalMissingCount());
List<TermGroupFacetCollector.FacetEntry> entries = airportResult.getFacetEntries(0, 10);
assertEquals(2, entries.size());