org.apache.lucene.search

Class TopFieldDocCollector

public class TopFieldDocCollector extends TopDocCollector

A {@link HitCollector} implementation that collects the top-sorting documents, returning them as a {@link TopFieldDocs}. This is used by {@link IndexSearcher} to implement {@link TopFieldDocs}-based search.

This may be extended, overriding the collect method to, e.g., conditionally invoke super() in order to filter which documents are collected.

Constructor Summary
TopFieldDocCollector(IndexReader reader, Sort sort, int numHits)
Construct to collect a given number of hits.
Method Summary
voidcollect(int doc, float score)
TopDocstopDocs()

Constructor Detail

TopFieldDocCollector

public TopFieldDocCollector(IndexReader reader, Sort sort, int numHits)
Construct to collect a given number of hits.

Parameters: reader the index to be searched sort the sort criteria numHits the maximum number of hits to collect

Method Detail

collect

public void collect(int doc, float score)

topDocs

public TopDocs topDocs()
Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.