Save This Page
Home » lucene-3.0.1-src » org.apache » lucene » index » [javadoc | source]
org.apache.lucene.index
public class: SegmentReader [javadoc | source]
java.lang.Object
   org.apache.lucene.index.IndexReader
      org.apache.lucene.index.SegmentReader

All Implemented Interfaces:
    Cloneable, Closeable

Direct Known Subclasses:
    ReadOnlySegmentReader, GCJSegmentReader

NOTE: This API is new and still experimental (subject to change suddenly in the next release)

Nested Class Summary:
static final class  SegmentReader.CoreReaders   
static class  SegmentReader.Ref   
final class  SegmentReader.Norm  Byte[] referencing is used because a new norm object needs to be created for each clone, and the byte array is all that is needed for sharing between cloned readers. The current norm referencing is for sharing between readers whereas the byte[] referencing is for copy on write which is independent of reader references (i.e. incRef, decRef). 
Field Summary
protected  boolean readOnly     
 CloseableThreadLocal<FieldsReader> fieldsReaderLocal     
 CloseableThreadLocal<TermVectorsReader> termVectorsLocal     
 BitVector deletedDocs     
 Ref deletedDocsRef     
 CoreReaders core     
 Map<String, Norm> norms     
Fields inherited from org.apache.lucene.index.IndexReader:
hasChanges,  DEFAULT_TERMS_INDEX_DIVISOR
Method from org.apache.lucene.index.SegmentReader Summary:
clone,   clone,   cloneDeletedDocs,   cloneNormBytes,   directory,   doClose,   doCommit,   doDelete,   doSetNorm,   doUndeleteAll,   docFreq,   document,   fieldInfos,   files,   get,   get,   getFieldCacheKey,   getFieldNames,   getFieldsReader,   getNorms,   getOnlySegmentReader,   getOnlySegmentReader,   getSegmentInfo,   getSegmentName,   getTermFreqVector,   getTermFreqVector,   getTermFreqVector,   getTermFreqVectors,   getTermInfosIndexDivisor,   getTermVectorsReader,   getTermVectorsReaderOrig,   getUniqueTermCount,   hasDeletions,   hasDeletions,   hasNorms,   hasSeparateNorms,   isDeleted,   loadTermsIndex,   maxDoc,   norms,   norms,   normsClosed,   normsClosed,   numDocs,   openDocStores,   reopenSegment,   rollbackCommit,   setSegmentInfo,   startCommit,   termDocs,   termDocs,   termPositions,   terms,   terms,   termsIndexLoaded,   usesCompoundFile
Methods from org.apache.lucene.index.IndexReader:
acquireWriteLock,   clone,   clone,   close,   commit,   commit,   decRef,   deleteDocument,   deleteDocuments,   directory,   doClose,   doCommit,   doDelete,   doSetNorm,   doUndeleteAll,   docFreq,   document,   document,   ensureOpen,   flush,   flush,   getCommitUserData,   getCommitUserData,   getCurrentVersion,   getFieldCacheKey,   getFieldNames,   getIndexCommit,   getRefCount,   getSequentialSubReaders,   getTermFreqVector,   getTermFreqVector,   getTermFreqVector,   getTermFreqVectors,   getTermInfosIndexDivisor,   getUniqueTermCount,   getVersion,   hasDeletions,   hasNorms,   incRef,   indexExists,   isCurrent,   isDeleted,   isOptimized,   lastModified,   listCommits,   main,   maxDoc,   norms,   norms,   numDeletedDocs,   numDocs,   open,   open,   open,   open,   open,   open,   open,   reopen,   reopen,   reopen,   setNorm,   setNorm,   termDocs,   termDocs,   termPositions,   termPositions,   terms,   terms,   undeleteAll
Methods from java.lang.Object:
clone,   equals,   finalize,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.lucene.index.SegmentReader Detail:
 public final synchronized Object clone() 
 public final synchronized IndexReader clone(boolean openReadOnly) throws CorruptIndexException, IOException 
 protected BitVector cloneDeletedDocs(BitVector bv) 
    Clones the deleteDocs BitVector. May be overridden by subclasses. New and experimental.
 protected byte[] cloneNormBytes(byte[] bytes) 
    Clones the norm bytes. May be overridden by subclasses. New and experimental.
 public Directory directory() 
    Returns the directory this index resides in.
 protected  void doClose() throws IOException 
 protected  void doCommit(Map<String, String> commitUserData) throws IOException 
 protected  void doDelete(int docNum) 
 protected  void doSetNorm(int doc,
    String field,
    byte value) throws IOException 
 protected  void doUndeleteAll() 
 public int docFreq(Term t) throws IOException 
 public Document document(int n,
    FieldSelector fieldSelector) throws CorruptIndexException, IOException 
 FieldInfos fieldInfos() 
 List<String> files() throws IOException 
 public static SegmentReader get(boolean readOnly,
    SegmentInfo si,
    int termInfosIndexDivisor) throws CorruptIndexException, IOException 
 public static SegmentReader get(boolean readOnly,
    Directory dir,
    SegmentInfo si,
    int readBufferSize,
    boolean doOpenStores,
    int termInfosIndexDivisor) throws CorruptIndexException, IOException 
 public final Object getFieldCacheKey() 
 public Collection<String> getFieldNames(FieldOption fieldOption) 
 FieldsReader getFieldsReader() 
 protected synchronized byte[] getNorms(String field) throws IOException 
 static SegmentReader getOnlySegmentReader(Directory dir) throws IOException 
Deprecated! Remove - this when tests are fixed!

    Lotsa tests did hacks like:
    SegmentReader reader = (SegmentReader) IndexReader.open(dir);
    They broke. This method serves as a hack to keep hacks working We do it with R/W access for the tests (BW compatibility)
 static SegmentReader getOnlySegmentReader(IndexReader reader) 
 SegmentInfo getSegmentInfo() 
    Return the SegmentInfo of the segment this reader is reading.
 public String getSegmentName() 
    Return the name of the segment this reader is reading.
 public TermFreqVector getTermFreqVector(int docNumber,
    String field) throws IOException 
    Return a term frequency vector for the specified document and field. The vector returned contains term numbers and frequencies for all terms in the specified field of this document, if the field had storeTermVector flag set. If the flag was not set, the method returns null.
 public  void getTermFreqVector(int docNumber,
    TermVectorMapper mapper) throws IOException 
 public  void getTermFreqVector(int docNumber,
    String field,
    TermVectorMapper mapper) throws IOException 
 public TermFreqVector[] getTermFreqVectors(int docNumber) throws IOException 
    Return an array of term frequency vectors for the specified document. The array contains a vector for each vectorized field in the document. Each vector vector contains term numbers and frequencies for all terms in a given vectorized field. If no such fields existed, the method returns null.
 public int getTermInfosIndexDivisor() 
 TermVectorsReader getTermVectorsReader() 
    Create a clone from the initial TermVectorsReader and store it in the ThreadLocal.
 TermVectorsReader getTermVectorsReaderOrig() 
 public long getUniqueTermCount() 
 public boolean hasDeletions() 
 static boolean hasDeletions(SegmentInfo si) throws IOException 
 public synchronized boolean hasNorms(String field) 
 static boolean hasSeparateNorms(SegmentInfo si) throws IOException 
 public synchronized boolean isDeleted(int n) 
  void loadTermsIndex(int termsIndexDivisor) throws IOException 
 public int maxDoc() 
 public synchronized byte[] norms(String field) throws IOException 
 public synchronized  void norms(String field,
    byte[] bytes,
    int offset) throws IOException 
    Read norms into a pre-allocated array.
 boolean normsClosed() 
 boolean normsClosed(String field) 
 public int numDocs() 
  void openDocStores() throws IOException 
 synchronized SegmentReader reopenSegment(SegmentInfo si,
    boolean doClone,
    boolean openReadOnly) throws CorruptIndexException, IOException 
  void rollbackCommit() 
  void setSegmentInfo(SegmentInfo info) 
  void startCommit() 
 public TermDocs termDocs() throws IOException 
 public TermDocs termDocs(Term term) throws IOException 
 public TermPositions termPositions() throws IOException 
 public TermEnum terms() 
 public TermEnum terms(Term t) throws IOException 
 boolean termsIndexLoaded() 
 static boolean usesCompoundFile(SegmentInfo si) throws IOException