org.apache.lucene.search
Class FieldCacheDocIdSet

java.lang.Object
  extended by org.apache.lucene.search.DocIdSet
      extended by org.apache.lucene.search.FieldCacheDocIdSet

public abstract class FieldCacheDocIdSet
extends DocIdSet

Base class for DocIdSet to be used with FieldCache. The implementation of its iterator is very stupid and slow if the implementation of the matchDoc(int) method is not optimized, as iterators simply increment the document id until matchDoc(int) returns true. Because of this matchDoc(int) must be as fast as possible and in no case do any I/O.

NOTE: This API is for internal purposes only and might change in incompatible ways in the next release.

Field Summary
protected  IndexReader reader
           
 
Fields inherited from class org.apache.lucene.search.DocIdSet
EMPTY_DOCIDSET
 
Constructor Summary
FieldCacheDocIdSet(IndexReader reader)
           
 
Method Summary
 boolean isCacheable()
          this DocIdSet is cacheable, if it works solely with FieldCache and no TermDocs
 DocIdSetIterator iterator()
          Provides a DocIdSetIterator to access the set.
protected abstract  boolean matchDoc(int doc)
          this method checks, if a doc is a hit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

reader

protected final IndexReader reader
Constructor Detail

FieldCacheDocIdSet

public FieldCacheDocIdSet(IndexReader reader)
Method Detail

matchDoc

protected abstract boolean matchDoc(int doc)
this method checks, if a doc is a hit


isCacheable

public final boolean isCacheable()
this DocIdSet is cacheable, if it works solely with FieldCache and no TermDocs

Overrides:
isCacheable in class DocIdSet

iterator

public final DocIdSetIterator iterator()
                                throws IOException
Description copied from class: DocIdSet
Provides a DocIdSetIterator to access the set. This implementation can return null or DocIdSet.EMPTY_DOCIDSET.iterator() if there are no docs that match.

Specified by:
iterator in class DocIdSet
Throws:
IOException