Save This Page
Home » lucene-2.3.2-src » org.apache » lucene » index » [javadoc | source]
org.apache.lucene.index
abstract class: DirectoryIndexReader [javadoc | source]
java.lang.Object
   org.apache.lucene.index.IndexReader
      org.apache.lucene.index.DirectoryIndexReader

Direct Known Subclasses:
    MultiSegmentReader, SegmentReader, GCJSegmentReader

IndexReader implementation that has access to a Directory. Instances that have a SegmentInfos object (i. e. segmentInfos != null) "own" the directory, which means that they try to acquire a write lock whenever index modifications are performed.
Field Summary
protected  Directory directory     
protected  boolean closeDirectory     
Fields inherited from org.apache.lucene.index.IndexReader:
hasChanges
Constructor:
 protected DirectoryIndexReader() 
 DirectoryIndexReader(Directory directory,
    SegmentInfos segmentInfos,
    boolean closeDirectory) 
Method from org.apache.lucene.index.DirectoryIndexReader Summary:
acquireWriteLock,   commitChanges,   directory,   doClose,   doCommit,   doReopen,   finalize,   getVersion,   init,   isCurrent,   isOptimized,   open,   reopen,   rollbackCommit,   setDeletionPolicy,   startCommit
Methods from org.apache.lucene.index.IndexReader:
acquireWriteLock,   close,   commit,   decRef,   deleteDocument,   deleteDocuments,   directory,   doClose,   doCommit,   doDelete,   doSetNorm,   doUndeleteAll,   docFreq,   document,   document,   ensureOpen,   flush,   getCurrentVersion,   getCurrentVersion,   getCurrentVersion,   getFieldNames,   getRefCount,   getTermFreqVector,   getTermFreqVector,   getTermFreqVector,   getTermFreqVectors,   getTermInfosIndexDivisor,   getVersion,   hasDeletions,   hasNorms,   incRef,   indexExists,   indexExists,   indexExists,   isCurrent,   isDeleted,   isLocked,   isLocked,   isOptimized,   lastModified,   lastModified,   lastModified,   main,   maxDoc,   norms,   norms,   numDocs,   open,   open,   open,   open,   reopen,   setNorm,   setNorm,   setTermInfosIndexDivisor,   termDocs,   termDocs,   termPositions,   termPositions,   terms,   terms,   undeleteAll,   unlock
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.apache.lucene.index.DirectoryIndexReader Detail:
 protected  void acquireWriteLock() throws IOException, StaleReaderException, CorruptIndexException, LockObtainFailedException 
    Tries to acquire the WriteLock on this directory. this method is only valid if this IndexReader is directory owner.
 abstract protected  void commitChanges() throws IOException
 public Directory directory() 
    Returns the directory this index resides in.
 protected  void doClose() throws IOException 
 protected  void doCommit() throws IOException 
    Commit changes resulting from delete, undeleteAll, or setNorm operations If an exception is hit, then either no changes or all changes will have been committed to the index (transactional semantics).
 abstract protected DirectoryIndexReader doReopen(SegmentInfos infos) throws IOException, CorruptIndexException
    Re-opens the index using the passed-in SegmentInfos
 protected  void finalize() throws Throwable 
    Release the write lock, if needed.
 public long getVersion() 
    Version number when this IndexReader was opened.
  void init(Directory directory,
    SegmentInfos segmentInfos,
    boolean closeDirectory) 
 public boolean isCurrent() throws IOException, CorruptIndexException 
    Check whether this IndexReader is still using the current (i.e., most recently committed) version of the index. If a writer has committed any changes to the index since this reader was opened, this will return false, in which case you must open a new IndexReader in order to see the changes. See the description of the autoCommit flag which controls when the IndexWriter actually commits changes to the index.
 public boolean isOptimized() 
    Checks is the index is optimized (if it has a single segment and no deletions)
 static DirectoryIndexReader open(Directory directory,
    boolean closeDirectory,
    IndexDeletionPolicy deletionPolicy) throws IOException, CorruptIndexException 
 public final synchronized IndexReader reopen() throws IOException, CorruptIndexException 
  void rollbackCommit() 
    Rolls back state to just before the commit (this is called by commit() if there is some exception while committing).
 public  void setDeletionPolicy(IndexDeletionPolicy deletionPolicy) 
  void startCommit() 
    Should internally checkpoint state that will change during commit so that we can rollback if necessary.