Index: src/java/org/apache/lucene/search/TopDocCollector.java =================================================================== --- src/java/org/apache/lucene/search/TopDocCollector.java (revision 685550) +++ src/java/org/apache/lucene/search/TopDocCollector.java (working copy) @@ -30,21 +30,34 @@ public class TopDocCollector extends HitCollector { private ScoreDoc reusableSD; - - int totalHits; - PriorityQueue hq; + + /** The total number of hits the collector encountered. */ + protected int totalHits; + + /** The priority queue which holds the top-scoring documents. */ + protected PriorityQueue hq; /** Construct to collect a given number of hits. * @param numHits the maximum number of hits to collect */ public TopDocCollector(int numHits) { - this(numHits, new HitQueue(numHits)); + this(new HitQueue(numHits)); } + /** @deprecated use TopDocCollector(hq) instead. numHits is not used by this + * constructor. It will be removed in a future release. + */ TopDocCollector(int numHits, PriorityQueue hq) { this.hq = hq; } + /** Constructor to collect the top-scoring documents by using the given PQ. + * @hq the PQ to use by this instance. + */ + protected TopDocCollector(PriorityQueue hq) { + this.hq = hq; + } + // javadoc inherited public void collect(int doc, float score) { if (score > 0.0f) { Index: src/java/org/apache/lucene/search/TopFieldDocCollector.java =================================================================== --- src/java/org/apache/lucene/search/TopFieldDocCollector.java (revision 685550) +++ src/java/org/apache/lucene/search/TopFieldDocCollector.java (working copy) @@ -40,7 +40,7 @@ */ public TopFieldDocCollector(IndexReader reader, Sort sort, int numHits) throws IOException { - super(numHits, new FieldSortedHitQueue(reader, sort.fields, numHits)); + super(new FieldSortedHitQueue(reader, sort.fields, numHits)); } // javadoc inherited