org.opencms.search
Class CmsSearchIndex.LazyContentReader

java.lang.Object
  extended by org.apache.lucene.index.IndexReader
      extended by org.apache.lucene.index.FilterIndexReader
          extended by org.opencms.search.CmsSearchIndex.LazyContentReader
All Implemented Interfaces:
java.io.Closeable, java.lang.Cloneable
Enclosing class:
CmsSearchIndex

protected class CmsSearchIndex.LazyContentReader
extends org.apache.lucene.index.FilterIndexReader

Lucene filter index reader implementation that will ensure the OpenCms default search index fields CmsSearchField.FIELD_CONTENT and CmsSearchField.FIELD_CONTENT_BLOB are lazy loaded.

This is to optimize performance - these 2 fields will be rather large especially for extracted binary documents like PDF, MS Office etc. By using lazy fields the data is only read when it is actually used.


Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.lucene.index.FilterIndexReader
org.apache.lucene.index.FilterIndexReader.FilterTermDocs, org.apache.lucene.index.FilterIndexReader.FilterTermEnum, org.apache.lucene.index.FilterIndexReader.FilterTermPositions
 
Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader
org.apache.lucene.index.IndexReader.FieldOption, org.apache.lucene.index.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
CmsSearchIndex.LazyContentReader(org.apache.lucene.index.IndexReader indexReader)
          Create a new lazy content reader.
 
Method Summary
protected  void doClose()
           
 org.apache.lucene.document.Document document(int n)
           
protected  org.apache.lucene.index.IndexReader doOpenIfChanged()
           
protected  org.apache.lucene.index.IndexReader doOpenIfChanged(boolean openReadOnly)
           
 org.apache.lucene.index.IndexReader reopen()
          Deprecated. since Lucene 3.5 but kept for backward compatibility
 
Methods inherited from class org.apache.lucene.index.FilterIndexReader
addReaderFinishedListener, directory, docFreq, doCommit, document, doDelete, doSetNorm, doUndeleteAll, getCommitUserData, getCoreCacheKey, getDeletesCacheKey, getFieldNames, getSequentialSubReaders, getTermFreqVector, getTermFreqVector, getTermFreqVector, getTermFreqVectors, getVersion, hasDeletions, hasNorms, isCurrent, isDeleted, isOptimized, maxDoc, norms, norms, numDocs, removeReaderFinishedListener, termDocs, termDocs, termPositions, terms, terms, toString
 
Methods inherited from class org.apache.lucene.index.IndexReader
acquireWriteLock, clone, clone, close, commit, commit, decRef, deleteDocument, deleteDocuments, doOpenIfChanged, doOpenIfChanged, ensureOpen, flush, flush, getCommitUserData, getCurrentVersion, getIndexCommit, getRefCount, getTermInfosIndexDivisor, getUniqueTermCount, incRef, indexExists, lastModified, listCommits, main, notifyReaderFinishedListeners, numDeletedDocs, open, open, open, open, open, open, open, open, openIfChanged, openIfChanged, openIfChanged, openIfChanged, readerFinished, reopen, reopen, reopen, setNorm, setNorm, termPositions, tryIncRef, undeleteAll
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CmsSearchIndex.LazyContentReader

public CmsSearchIndex.LazyContentReader(org.apache.lucene.index.IndexReader indexReader)
Create a new lazy content reader.

Parameters:
indexReader - the index reader to use this lazy content reader with
Method Detail

document

public org.apache.lucene.document.Document document(int n)
                                             throws org.apache.lucene.index.CorruptIndexException,
                                                    java.io.IOException
Overrides:
document in class org.apache.lucene.index.IndexReader
Throws:
org.apache.lucene.index.CorruptIndexException
java.io.IOException
See Also:
IndexReader.document(int)

reopen

@Deprecated
public org.apache.lucene.index.IndexReader reopen()
                                           throws org.apache.lucene.index.CorruptIndexException,
                                                  java.io.IOException
Deprecated. since Lucene 3.5 but kept for backward compatibility

Overrides:
reopen in class org.apache.lucene.index.IndexReader
Throws:
org.apache.lucene.index.CorruptIndexException
java.io.IOException
See Also:
IndexReader.reopen()

doClose

protected void doClose()
                throws java.io.IOException
Overrides:
doClose in class org.apache.lucene.index.FilterIndexReader
Throws:
java.io.IOException
See Also:
FilterIndexReader.doClose()

doOpenIfChanged

protected org.apache.lucene.index.IndexReader doOpenIfChanged()
                                                       throws org.apache.lucene.index.CorruptIndexException,
                                                              java.io.IOException
Overrides:
doOpenIfChanged in class org.apache.lucene.index.IndexReader
Throws:
org.apache.lucene.index.CorruptIndexException
java.io.IOException
See Also:
IndexReader.doOpenIfChanged()

doOpenIfChanged

protected org.apache.lucene.index.IndexReader doOpenIfChanged(boolean openReadOnly)
                                                       throws org.apache.lucene.index.CorruptIndexException,
                                                              java.io.IOException
Overrides:
doOpenIfChanged in class org.apache.lucene.index.IndexReader
Throws:
org.apache.lucene.index.CorruptIndexException
java.io.IOException
See Also:
IndexReader.doOpenIfChanged(boolean)