From 470c89a2b2f9fdaf2ca268b7404dae3ac9768610 Mon Sep 17 00:00:00 2001 From: Michael McCandless Date: Sun, 6 Dec 2009 23:56:31 +0000 Subject: [PATCH] LUCENE-2119: use numDocs() not maxDoc() as max nDocs we pass to PQ git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@887803 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/lucene/search/IndexSearcher.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/java/org/apache/lucene/search/IndexSearcher.java b/src/java/org/apache/lucene/search/IndexSearcher.java index 4abda95060b..11b83abcb29 100644 --- a/src/java/org/apache/lucene/search/IndexSearcher.java +++ b/src/java/org/apache/lucene/search/IndexSearcher.java @@ -164,7 +164,7 @@ public class IndexSearcher extends Searcher { throw new IllegalArgumentException("nDocs must be > 0"); } - nDocs = Math.min(nDocs, reader.maxDoc()); + nDocs = Math.min(nDocs, reader.numDocs()); TopScoreDocCollector collector = TopScoreDocCollector.create(nDocs, !weight.scoresDocsOutOfOrder()); search(weight, filter, collector); @@ -192,7 +192,7 @@ public class IndexSearcher extends Searcher { Sort sort, boolean fillFields) throws IOException { - nDocs = Math.min(nDocs, reader.maxDoc()); + nDocs = Math.min(nDocs, reader.numDocs()); TopFieldCollector collector = TopFieldCollector.create(sort, nDocs, fillFields, fieldSortDoTrackScores, fieldSortDoMaxScore, !weight.scoresDocsOutOfOrder());