org.apache.lucene.index
Class MultiPassIndexSplitter.FakeDeleteIndexReader

java.lang.Object
  extended by org.apache.lucene.index.IndexReader
      extended by org.apache.lucene.index.FilterIndexReader
          extended by org.apache.lucene.index.MultiPassIndexSplitter.FakeDeleteIndexReader
All Implemented Interfaces:
Closeable, Cloneable
Enclosing class:
MultiPassIndexSplitter

public static class MultiPassIndexSplitter.FakeDeleteIndexReader
extends FilterIndexReader

This class pretends that it can write deletions to the underlying index. Instead, deletions are buffered in a bitset and overlaid with the original list of deletions.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.lucene.index.FilterIndexReader
FilterIndexReader.FilterTermDocs, FilterIndexReader.FilterTermEnum, FilterIndexReader.FilterTermPositions
 
Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader
IndexReader.FieldOption, IndexReader.ReaderFinishedListener
 
Field Summary
 
Fields inherited from class org.apache.lucene.index.FilterIndexReader
in
 
Fields inherited from class org.apache.lucene.index.IndexReader
hasChanges, readerFinishedListeners
 
Constructor Summary
MultiPassIndexSplitter.FakeDeleteIndexReader(IndexReader in)
           
 
Method Summary
protected  void doDelete(int n)
          Implements deletion of the document numbered docNum.
protected  void doUndeleteAll()
          Just removes our overlaid deletions - does not undelete the original deletions.
 IndexReader[] getSequentialSubReaders()
          Expert: returns the sequential sub readers that this reader is logically composed of.
 boolean hasDeletions()
          Returns true if any documents have been deleted
 boolean isDeleted(int n)
          Returns true if document n has been deleted
 int numDocs()
          Returns the number of documents in this index.
 TermPositions termPositions()
          Returns an unpositioned TermPositions enumerator.
 
Methods inherited from class org.apache.lucene.index.FilterIndexReader
addReaderFinishedListener, directory, docFreq, doClose, doCommit, document, doSetNorm, getCoreCacheKey, getDeletesCacheKey, getFieldNames, getTermFreqVector, getTermFreqVector, getTermFreqVector, getTermFreqVectors, getVersion, hasNorms, isCurrent, isOptimized, maxDoc, norms, norms, removeReaderFinishedListener, termDocs, termDocs, terms, terms, toString
 
Methods inherited from class org.apache.lucene.index.IndexReader
acquireWriteLock, clone, clone, close, commit, commit, decRef, deleteDocument, deleteDocuments, document, ensureOpen, flush, flush, getCommitUserData, getCommitUserData, getCurrentVersion, getIndexCommit, getRefCount, getTermInfosIndexDivisor, getUniqueTermCount, incRef, indexExists, lastModified, listCommits, main, notifyReaderFinishedListeners, numDeletedDocs, open, open, open, open, open, open, open, open, readerFinished, reopen, reopen, reopen, reopen, setNorm, setNorm, termPositions, undeleteAll
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

MultiPassIndexSplitter.FakeDeleteIndexReader

public MultiPassIndexSplitter.FakeDeleteIndexReader(IndexReader in)
Method Detail

numDocs

public int numDocs()
Description copied from class: IndexReader
Returns the number of documents in this index.

Overrides:
numDocs in class FilterIndexReader

doUndeleteAll

protected void doUndeleteAll()
                      throws CorruptIndexException,
                             IOException
Just removes our overlaid deletions - does not undelete the original deletions.

Overrides:
doUndeleteAll in class FilterIndexReader
Throws:
CorruptIndexException
IOException

doDelete

protected void doDelete(int n)
                 throws CorruptIndexException,
                        IOException
Description copied from class: IndexReader
Implements deletion of the document numbered docNum. Applications should call IndexReader.deleteDocument(int) or IndexReader.deleteDocuments(Term).

Overrides:
doDelete in class FilterIndexReader
Throws:
CorruptIndexException
IOException

hasDeletions

public boolean hasDeletions()
Description copied from class: IndexReader
Returns true if any documents have been deleted

Overrides:
hasDeletions in class FilterIndexReader

isDeleted

public boolean isDeleted(int n)
Description copied from class: IndexReader
Returns true if document n has been deleted

Overrides:
isDeleted in class FilterIndexReader

getSequentialSubReaders

public IndexReader[] getSequentialSubReaders()
Description copied from class: IndexReader
Expert: returns the sequential sub readers that this reader is logically composed of. For example, IndexSearcher uses this API to drive searching by one sub reader at a time. If this reader is not composed of sequential child readers, it should return null. If this method returns an empty array, that means this reader is a null reader (for example a MultiReader that has no sub readers).

NOTE: You should not try using sub-readers returned by this method to make any changes (setNorm, deleteDocument, etc.). While this might succeed for one composite reader (like MultiReader), it will most likely lead to index corruption for other readers (like DirectoryReader obtained through IndexReader.open(org.apache.lucene.store.Directory). Use the parent reader directly.

Overrides:
getSequentialSubReaders in class FilterIndexReader

termPositions

public TermPositions termPositions()
                            throws IOException
Description copied from class: IndexReader
Returns an unpositioned TermPositions enumerator.

Overrides:
termPositions in class FilterIndexReader
Throws:
IOException - if there is a low-level IO error


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