diff --git a/solr/core/src/java/org/apache/solr/search/facet/TopDocsAgg.java b/solr/core/src/java/org/apache/solr/search/facet/TopDocsAgg.java index af6bf3d44d62..2695ee1cc0e5 100644 --- a/solr/core/src/java/org/apache/solr/search/facet/TopDocsAgg.java +++ b/solr/core/src/java/org/apache/solr/search/facet/TopDocsAgg.java @@ -34,6 +34,7 @@ import org.apache.lucene.search.Sort; import org.apache.lucene.search.SortField; import org.apache.lucene.search.TopDocs; +import org.apache.lucene.search.TotalHits; import org.apache.solr.common.SolrDocument; import org.apache.solr.common.SolrDocumentList; import org.apache.solr.common.SolrException; @@ -295,9 +296,9 @@ private int buildResultForSlot(Query slotQuery, int slot) throws IOException { int offset = 0; TopDocs topDocs = fcontext.searcher.search(finalQuery, limit, sort); - long totalHits = topDocs.totalHits; + long totalHits = topDocs.totalHits.value; int nDocsReturned = topDocs.scoreDocs.length; - float maxScore = totalHits>0 ? topDocs.getMaxScore() : 0.0f; + float maxScore = totalHits > 0 ? topDocs.scoreDocs[0].score : 0.0f; int[] ids = new int[nDocsReturned]; float scores[] = doScores ? new float[nDocsReturned] : null; for (int i=0; i