org.apache.lucene.facet.search
Class ScoredDocIdCollector

java.lang.Object
  extended by org.apache.lucene.search.Collector
      extended by org.apache.lucene.facet.search.ScoredDocIdCollector

public abstract class ScoredDocIdCollector
extends org.apache.lucene.search.Collector

A Collector which stores all docIDs and their scores in a ScoredDocIDs instance. If scoring is not enabled, then the default score as set in setDefaultScore(float) (or ScoredDocIDsIterator.DEFAULT_SCORE) will be set for all documents.

WARNING: This API is experimental and might change in incompatible ways in the next release.

Field Summary
protected  int docBase
           
protected  org.apache.lucene.util.OpenBitSet docIds
           
protected  int numDocIds
           
 
Method Summary
static ScoredDocIdCollector create(int maxDoc, boolean enableScoring)
          Creates a new ScoredDocIdCollector with the given parameters.
abstract  float getDefaultScore()
          Returns the default score used when scoring is disabled.
 ScoredDocIDs getScoredDocIDs()
           
abstract  ScoredDocIDsIterator scoredDocIdsIterator()
           
abstract  void setDefaultScore(float defaultScore)
          Set the default score.
 void setNextReader(org.apache.lucene.index.IndexReader reader, int base)
           
 
Methods inherited from class org.apache.lucene.search.Collector
acceptsDocsOutOfOrder, collect, setScorer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

numDocIds

protected int numDocIds

docBase

protected int docBase

docIds

protected final org.apache.lucene.util.OpenBitSet docIds
Method Detail

create

public static ScoredDocIdCollector create(int maxDoc,
                                          boolean enableScoring)
Creates a new ScoredDocIdCollector with the given parameters.

Parameters:
maxDoc - the number of documents that are expected to be collected. Note that if more documents are collected, unexpected exceptions may be thrown. Usually you should pass IndexReader.maxDoc() of the same IndexReader with which the search is executed.
enableScoring - if scoring is enabled, a score will be computed for every matching document, which might be expensive. Therefore if you do not require scoring, it is better to set it to false.

getDefaultScore

public abstract float getDefaultScore()
Returns the default score used when scoring is disabled.


setDefaultScore

public abstract void setDefaultScore(float defaultScore)
Set the default score. Only applicable if scoring is disabled.


scoredDocIdsIterator

public abstract ScoredDocIDsIterator scoredDocIdsIterator()
                                                   throws IOException
Throws:
IOException

getScoredDocIDs

public ScoredDocIDs getScoredDocIDs()

setNextReader

public void setNextReader(org.apache.lucene.index.IndexReader reader,
                          int base)
                   throws IOException
Specified by:
setNextReader in class org.apache.lucene.search.Collector
Throws:
IOException


Copyright © 2000-2011 Apache Software Foundation. All Rights Reserved.