|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.search.Collector org.apache.lucene.search.TopDocsCollector<FieldValueHitQueue.Entry> org.apache.lucene.search.TopFieldCollector
public abstract class TopFieldCollector
A Collector
that sorts by SortField
using
FieldComparator
s.
create(org.apache.lucene.search.Sort, int, boolean, boolean, boolean, boolean)
method
for instantiating a TopFieldCollector.
Field Summary |
---|
Fields inherited from class org.apache.lucene.search.TopDocsCollector |
---|
EMPTY_TOPDOCS, pq, totalHits |
Method Summary | |
---|---|
boolean |
acceptsDocsOutOfOrder()
Return true if this collector does not
require the matching docIDs to be delivered in int sort
order (smallest to largest) to Collector.collect(int) . |
static TopFieldCollector |
create(Sort sort,
int numHits,
boolean fillFields,
boolean trackDocScores,
boolean trackMaxScore,
boolean docsScoredInOrder)
Creates a new TopFieldCollector from the given
arguments. |
protected TopDocs |
newTopDocs(ScoreDoc[] results,
int start)
Returns a TopDocs instance containing the given results. |
protected void |
populateResults(ScoreDoc[] results,
int howMany)
Populates the results array with the ScoreDoc instances. |
Methods inherited from class org.apache.lucene.search.TopDocsCollector |
---|
getTotalHits, topDocs, topDocs, topDocs |
Methods inherited from class org.apache.lucene.search.Collector |
---|
collect, setNextReader, setScorer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static TopFieldCollector create(Sort sort, int numHits, boolean fillFields, boolean trackDocScores, boolean trackMaxScore, boolean docsScoredInOrder) throws IOException
TopFieldCollector
from the given
arguments.
NOTE: The instances returned by this method
pre-allocate a full array of length
numHits
.
sort
- the sort criteria (SortFields).numHits
- the number of results to collect.fillFields
- specifies whether the actual field values should be returned on
the results (FieldDoc).trackDocScores
- specifies whether document scores should be tracked and set on the
results. Note that if set to false, then the results' scores will
be set to Float.NaN. Setting this to true affects performance, as
it incurs the score computation on each competitive result.
Therefore if document scores are not required by the application,
it is recommended to set it to false.trackMaxScore
- specifies whether the query's maxScore should be tracked and set
on the resulting TopDocs
. Note that if set to false,
TopDocs.getMaxScore()
returns Float.NaN. Setting this to
true affects performance as it incurs the score computation on
each result. Also, setting this true automatically sets
trackDocScores
to true as well.docsScoredInOrder
- specifies whether documents are scored in doc Id order or not by
the given Scorer
in Collector.setScorer(Scorer)
.
TopFieldCollector
instance which will sort the results by
the sort criteria.
IOException
protected void populateResults(ScoreDoc[] results, int howMany)
TopDocsCollector
populateResults
in class TopDocsCollector<FieldValueHitQueue.Entry>
protected TopDocs newTopDocs(ScoreDoc[] results, int start)
TopDocsCollector
TopDocs
instance containing the given results. If
results
is null it means there are no results to return,
either because there were 0 calls to collect() or because the arguments to
topDocs were invalid.
newTopDocs
in class TopDocsCollector<FieldValueHitQueue.Entry>
public boolean acceptsDocsOutOfOrder()
Collector
true
if this collector does not
require the matching docIDs to be delivered in int sort
order (smallest to largest) to Collector.collect(int)
.
Most Lucene Query implementations will visit
matching docIDs in order. However, some queries
(currently limited to certain cases of BooleanQuery
) can achieve faster searching if the
Collector
allows them to deliver the
docIDs out of order.
Many collectors don't mind getting docIDs out of
order, so it's important to return true
here.
acceptsDocsOutOfOrder
in class Collector
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |