org.apache.solr.search
Class SolrIndexReader

java.lang.Object
  extended by org.apache.lucene.index.IndexReader
      extended by org.apache.lucene.index.FilterIndexReader
          extended by org.apache.solr.search.SolrIndexReader
All Implemented Interfaces:
Closeable, Cloneable

public class SolrIndexReader
extends org.apache.lucene.index.FilterIndexReader

Solr wrapper for IndexReader that contains extra context. This is currently experimental, for internal use only, and subject to change.


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
SolrIndexReader(org.apache.lucene.index.IndexReader in, SolrIndexReader parent, int base)
          Recursively wrap an IndexReader in SolrIndexReader instances.
 
Method Summary
 void associateInfo(SolrIndexReader source)
          Copies SolrReaderInfo instances from the source to this SolrIndexReader
 Object clone()
           
 org.apache.lucene.index.IndexReader clone(boolean openReadOnly)
           
 void decRef()
           
 void deleteDocument(int docNum)
           
 int deleteDocuments(org.apache.lucene.index.Term term)
           
 org.apache.lucene.store.Directory directory()
           
 int docFreq(org.apache.lucene.index.Term t)
           
protected  void doClose()
           
 org.apache.lucene.document.Document document(int n)
           
 org.apache.lucene.document.Document document(int n, org.apache.lucene.document.FieldSelector fieldSelector)
           
protected  void doDelete(int n)
           
protected  void doSetNorm(int d, String f, byte b)
           
protected  void doUndeleteAll()
           
 boolean equals(Object o)
           
 int getBase()
          returns the docid offset within the parent reader
 Map getCommitUserData()
           
 Object getCoreCacheKey()
           
 Collection getFieldNames(org.apache.lucene.index.IndexReader.FieldOption fieldNames)
           
 org.apache.lucene.index.IndexCommit getIndexCommit()
           
 int[] getLeafOffsets()
          Return the doc id offsets for each leaf reader.
 SolrIndexReader[] getLeafReaders()
          return the leaf readers in this reader tree, or an array of size 1 containing "this" if "this" is a leaf
 SolrIndexReader getParent()
          returns the parent reader, or null of none
 int getRefCount()
           
 SolrIndexReader[] getSequentialSubReaders()
           
 org.apache.lucene.index.TermFreqVector getTermFreqVector(int docNumber, String field)
           
 void getTermFreqVector(int docNumber, String field, org.apache.lucene.index.TermVectorMapper mapper)
           
 void getTermFreqVector(int docNumber, org.apache.lucene.index.TermVectorMapper mapper)
           
 org.apache.lucene.index.TermFreqVector[] getTermFreqVectors(int docNumber)
           
 int getTermInfosIndexDivisor()
           
 long getUniqueTermCount()
           
 long getVersion()
           
 org.apache.lucene.index.IndexReader getWrappedReader()
           
 boolean hasDeletions()
           
 int hashCode()
           
 boolean hasNorms(String field)
           
 void incRef()
           
 boolean isCurrent()
           
 boolean isDeleted(int n)
           
 boolean isOptimized()
           
 int maxDoc()
           
 byte[] norms(String f)
           
 void norms(String f, byte[] bytes, int offset)
           
 int numDeletedDocs()
           
 int numDocs()
           
static int readerIndex(int doc, int[] offsets)
          Given an array of IndexReader offsets, find which contains the given doc
 SolrIndexReader reopen()
           
 SolrIndexReader reopen(boolean openReadOnly)
           
 org.apache.lucene.index.IndexReader reopen(org.apache.lucene.index.IndexCommit commit)
           
 void setNorm(int doc, String field, byte value)
           
 void setNorm(int doc, String field, float value)
           
 org.apache.lucene.index.TermDocs termDocs()
           
 org.apache.lucene.index.TermDocs termDocs(org.apache.lucene.index.Term term)
           
 org.apache.lucene.index.TermPositions termPositions()
           
 org.apache.lucene.index.TermPositions termPositions(org.apache.lucene.index.Term term)
           
 org.apache.lucene.index.TermEnum terms()
           
 org.apache.lucene.index.TermEnum terms(org.apache.lucene.index.Term t)
           
 String toString()
           
 void undeleteAll()
           
 
Methods inherited from class org.apache.lucene.index.FilterIndexReader
addReaderFinishedListener, doCommit, getDeletesCacheKey, removeReaderFinishedListener
 
Methods inherited from class org.apache.lucene.index.IndexReader
acquireWriteLock, close, commit, commit, doOpenIfChanged, doOpenIfChanged, doOpenIfChanged, doOpenIfChanged, ensureOpen, flush, flush, getCommitUserData, getCurrentVersion, indexExists, lastModified, listCommits, main, notifyReaderFinishedListeners, open, open, open, open, open, open, open, open, openIfChanged, openIfChanged, openIfChanged, openIfChanged, readerFinished, reopen, tryIncRef
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SolrIndexReader

public SolrIndexReader(org.apache.lucene.index.IndexReader in,
                       SolrIndexReader parent,
                       int base)
Recursively wrap an IndexReader in SolrIndexReader instances.

Parameters:
in - the reader to wrap
parent - the parent, if any (null if none)
base - the docid offset in the parent (0 if top level)
Method Detail

getLeafReaders

public SolrIndexReader[] getLeafReaders()
return the leaf readers in this reader tree, or an array of size 1 containing "this" if "this" is a leaf


getLeafOffsets

public int[] getLeafOffsets()
Return the doc id offsets for each leaf reader. This will be different than getBase() for any leaf reader who is not a direct descendant of "this".


readerIndex

public static int readerIndex(int doc,
                              int[] offsets)
Given an array of IndexReader offsets, find which contains the given doc


toString

public String toString()
Overrides:
toString in class org.apache.lucene.index.FilterIndexReader

associateInfo

public void associateInfo(SolrIndexReader source)
Copies SolrReaderInfo instances from the source to this SolrIndexReader


getWrappedReader

public org.apache.lucene.index.IndexReader getWrappedReader()

getParent

public SolrIndexReader getParent()
returns the parent reader, or null of none


getBase

public int getBase()
returns the docid offset within the parent reader


directory

public org.apache.lucene.store.Directory directory()
Overrides:
directory in class org.apache.lucene.index.FilterIndexReader

getTermFreqVectors

public org.apache.lucene.index.TermFreqVector[] getTermFreqVectors(int docNumber)
                                                            throws IOException
Overrides:
getTermFreqVectors in class org.apache.lucene.index.FilterIndexReader
Throws:
IOException

getTermFreqVector

public org.apache.lucene.index.TermFreqVector getTermFreqVector(int docNumber,
                                                                String field)
                                                         throws IOException
Overrides:
getTermFreqVector in class org.apache.lucene.index.FilterIndexReader
Throws:
IOException

getTermFreqVector

public void getTermFreqVector(int docNumber,
                              String field,
                              org.apache.lucene.index.TermVectorMapper mapper)
                       throws IOException
Overrides:
getTermFreqVector in class org.apache.lucene.index.FilterIndexReader
Throws:
IOException

getTermFreqVector

public void getTermFreqVector(int docNumber,
                              org.apache.lucene.index.TermVectorMapper mapper)
                       throws IOException
Overrides:
getTermFreqVector in class org.apache.lucene.index.FilterIndexReader
Throws:
IOException

numDocs

public int numDocs()
Overrides:
numDocs in class org.apache.lucene.index.FilterIndexReader

maxDoc

public int maxDoc()
Overrides:
maxDoc in class org.apache.lucene.index.FilterIndexReader

document

public org.apache.lucene.document.Document document(int n,
                                                    org.apache.lucene.document.FieldSelector fieldSelector)
                                             throws org.apache.lucene.index.CorruptIndexException,
                                                    IOException
Overrides:
document in class org.apache.lucene.index.FilterIndexReader
Throws:
org.apache.lucene.index.CorruptIndexException
IOException

isDeleted

public boolean isDeleted(int n)
Overrides:
isDeleted in class org.apache.lucene.index.FilterIndexReader

hasDeletions

public boolean hasDeletions()
Overrides:
hasDeletions in class org.apache.lucene.index.FilterIndexReader

doUndeleteAll

protected void doUndeleteAll()
                      throws org.apache.lucene.index.CorruptIndexException,
                             IOException
Overrides:
doUndeleteAll in class org.apache.lucene.index.FilterIndexReader
Throws:
org.apache.lucene.index.CorruptIndexException
IOException

hasNorms

public boolean hasNorms(String field)
                 throws IOException
Overrides:
hasNorms in class org.apache.lucene.index.FilterIndexReader
Throws:
IOException

norms

public byte[] norms(String f)
             throws IOException
Overrides:
norms in class org.apache.lucene.index.FilterIndexReader
Throws:
IOException

norms

public void norms(String f,
                  byte[] bytes,
                  int offset)
           throws IOException
Overrides:
norms in class org.apache.lucene.index.FilterIndexReader
Throws:
IOException

doSetNorm

protected void doSetNorm(int d,
                         String f,
                         byte b)
                  throws org.apache.lucene.index.CorruptIndexException,
                         IOException
Overrides:
doSetNorm in class org.apache.lucene.index.FilterIndexReader
Throws:
org.apache.lucene.index.CorruptIndexException
IOException

terms

public org.apache.lucene.index.TermEnum terms()
                                       throws IOException
Overrides:
terms in class org.apache.lucene.index.FilterIndexReader
Throws:
IOException

terms

public org.apache.lucene.index.TermEnum terms(org.apache.lucene.index.Term t)
                                       throws IOException
Overrides:
terms in class org.apache.lucene.index.FilterIndexReader
Throws:
IOException

docFreq

public int docFreq(org.apache.lucene.index.Term t)
            throws IOException
Overrides:
docFreq in class org.apache.lucene.index.FilterIndexReader
Throws:
IOException

termDocs

public org.apache.lucene.index.TermDocs termDocs()
                                          throws IOException
Overrides:
termDocs in class org.apache.lucene.index.FilterIndexReader
Throws:
IOException

termDocs

public org.apache.lucene.index.TermDocs termDocs(org.apache.lucene.index.Term term)
                                          throws IOException
Overrides:
termDocs in class org.apache.lucene.index.FilterIndexReader
Throws:
IOException

termPositions

public org.apache.lucene.index.TermPositions termPositions()
                                                    throws IOException
Overrides:
termPositions in class org.apache.lucene.index.FilterIndexReader
Throws:
IOException

doDelete

protected void doDelete(int n)
                 throws org.apache.lucene.index.CorruptIndexException,
                        IOException
Overrides:
doDelete in class org.apache.lucene.index.FilterIndexReader
Throws:
org.apache.lucene.index.CorruptIndexException
IOException

doClose

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

getFieldNames

public Collection getFieldNames(org.apache.lucene.index.IndexReader.FieldOption fieldNames)
Overrides:
getFieldNames in class org.apache.lucene.index.FilterIndexReader

getVersion

public long getVersion()
Overrides:
getVersion in class org.apache.lucene.index.FilterIndexReader

isCurrent

public boolean isCurrent()
                  throws org.apache.lucene.index.CorruptIndexException,
                         IOException
Overrides:
isCurrent in class org.apache.lucene.index.FilterIndexReader
Throws:
org.apache.lucene.index.CorruptIndexException
IOException

isOptimized

public boolean isOptimized()
Overrides:
isOptimized in class org.apache.lucene.index.FilterIndexReader

getSequentialSubReaders

public SolrIndexReader[] getSequentialSubReaders()
Overrides:
getSequentialSubReaders in class org.apache.lucene.index.FilterIndexReader

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

getRefCount

public int getRefCount()
Overrides:
getRefCount in class org.apache.lucene.index.IndexReader

reopen

public org.apache.lucene.index.IndexReader reopen(org.apache.lucene.index.IndexCommit commit)
                                           throws org.apache.lucene.index.CorruptIndexException,
                                                  IOException
Overrides:
reopen in class org.apache.lucene.index.IndexReader
Throws:
org.apache.lucene.index.CorruptIndexException
IOException

clone

public Object clone()
Overrides:
clone in class org.apache.lucene.index.IndexReader

clone

public org.apache.lucene.index.IndexReader clone(boolean openReadOnly)
                                          throws org.apache.lucene.index.CorruptIndexException,
                                                 IOException
Overrides:
clone in class org.apache.lucene.index.IndexReader
Throws:
org.apache.lucene.index.CorruptIndexException
IOException

getCommitUserData

public Map getCommitUserData()
Overrides:
getCommitUserData in class org.apache.lucene.index.FilterIndexReader

getUniqueTermCount

public long getUniqueTermCount()
                        throws IOException
Overrides:
getUniqueTermCount in class org.apache.lucene.index.IndexReader
Throws:
IOException

reopen

public SolrIndexReader reopen(boolean openReadOnly)
                       throws IOException
Overrides:
reopen in class org.apache.lucene.index.IndexReader
Throws:
IOException

reopen

public SolrIndexReader reopen()
                       throws org.apache.lucene.index.CorruptIndexException,
                              IOException
Overrides:
reopen in class org.apache.lucene.index.IndexReader
Throws:
org.apache.lucene.index.CorruptIndexException
IOException

decRef

public void decRef()
            throws IOException
Overrides:
decRef in class org.apache.lucene.index.IndexReader
Throws:
IOException

deleteDocument

public void deleteDocument(int docNum)
                    throws org.apache.lucene.index.StaleReaderException,
                           org.apache.lucene.index.CorruptIndexException,
                           org.apache.lucene.store.LockObtainFailedException,
                           IOException
Overrides:
deleteDocument in class org.apache.lucene.index.IndexReader
Throws:
org.apache.lucene.index.StaleReaderException
org.apache.lucene.index.CorruptIndexException
org.apache.lucene.store.LockObtainFailedException
IOException

deleteDocuments

public int deleteDocuments(org.apache.lucene.index.Term term)
                    throws org.apache.lucene.index.StaleReaderException,
                           org.apache.lucene.index.CorruptIndexException,
                           org.apache.lucene.store.LockObtainFailedException,
                           IOException
Overrides:
deleteDocuments in class org.apache.lucene.index.IndexReader
Throws:
org.apache.lucene.index.StaleReaderException
org.apache.lucene.index.CorruptIndexException
org.apache.lucene.store.LockObtainFailedException
IOException

document

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

getIndexCommit

public org.apache.lucene.index.IndexCommit getIndexCommit()
                                                   throws IOException
Overrides:
getIndexCommit in class org.apache.lucene.index.IndexReader
Throws:
IOException

incRef

public void incRef()
Overrides:
incRef in class org.apache.lucene.index.IndexReader

numDeletedDocs

public int numDeletedDocs()
Overrides:
numDeletedDocs in class org.apache.lucene.index.IndexReader

setNorm

public void setNorm(int doc,
                    String field,
                    byte value)
             throws org.apache.lucene.index.StaleReaderException,
                    org.apache.lucene.index.CorruptIndexException,
                    org.apache.lucene.store.LockObtainFailedException,
                    IOException
Overrides:
setNorm in class org.apache.lucene.index.IndexReader
Throws:
org.apache.lucene.index.StaleReaderException
org.apache.lucene.index.CorruptIndexException
org.apache.lucene.store.LockObtainFailedException
IOException

setNorm

public void setNorm(int doc,
                    String field,
                    float value)
             throws org.apache.lucene.index.StaleReaderException,
                    org.apache.lucene.index.CorruptIndexException,
                    org.apache.lucene.store.LockObtainFailedException,
                    IOException
Overrides:
setNorm in class org.apache.lucene.index.IndexReader
Throws:
org.apache.lucene.index.StaleReaderException
org.apache.lucene.index.CorruptIndexException
org.apache.lucene.store.LockObtainFailedException
IOException

termPositions

public org.apache.lucene.index.TermPositions termPositions(org.apache.lucene.index.Term term)
                                                    throws IOException
Overrides:
termPositions in class org.apache.lucene.index.IndexReader
Throws:
IOException

undeleteAll

public void undeleteAll()
                 throws org.apache.lucene.index.StaleReaderException,
                        org.apache.lucene.index.CorruptIndexException,
                        org.apache.lucene.store.LockObtainFailedException,
                        IOException
Overrides:
undeleteAll in class org.apache.lucene.index.IndexReader
Throws:
org.apache.lucene.index.StaleReaderException
org.apache.lucene.index.CorruptIndexException
org.apache.lucene.store.LockObtainFailedException
IOException

getCoreCacheKey

public Object getCoreCacheKey()
Overrides:
getCoreCacheKey in class org.apache.lucene.index.FilterIndexReader

getTermInfosIndexDivisor

public int getTermInfosIndexDivisor()
Overrides:
getTermInfosIndexDivisor in class org.apache.lucene.index.IndexReader


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