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
This commit is contained in:
Michael McCandless 2009-12-06 23:56:31 +00:00
parent ae72952fa4
commit 470c89a2b2
1 changed files with 2 additions and 2 deletions

View File

@ -164,7 +164,7 @@ public class IndexSearcher extends Searcher {
throw new IllegalArgumentException("nDocs must be > 0"); 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()); TopScoreDocCollector collector = TopScoreDocCollector.create(nDocs, !weight.scoresDocsOutOfOrder());
search(weight, filter, collector); search(weight, filter, collector);
@ -192,7 +192,7 @@ public class IndexSearcher extends Searcher {
Sort sort, boolean fillFields) Sort sort, boolean fillFields)
throws IOException { throws IOException {
nDocs = Math.min(nDocs, reader.maxDoc()); nDocs = Math.min(nDocs, reader.numDocs());
TopFieldCollector collector = TopFieldCollector.create(sort, nDocs, TopFieldCollector collector = TopFieldCollector.create(sort, nDocs,
fillFields, fieldSortDoTrackScores, fieldSortDoMaxScore, !weight.scoresDocsOutOfOrder()); fillFields, fieldSortDoTrackScores, fieldSortDoMaxScore, !weight.scoresDocsOutOfOrder());