## org.apache.lucene.store.instantiated
Class InstantiatedIndexReader

    java.lang.Object
      org.apache.lucene.index.IndexReader
          org.apache.lucene.store.instantiated.InstantiatedIndexReader

    public class InstantiatedIndexReader

extends IndexReader

An InstantiatedIndexReader is not a snapshot in time, it is completely in sync with the latest commit to the store!

Consider using InstantiatedIndex as if it was immutable.

Nested Class Summary

Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader
`IndexReader.FieldOption`

Field Summary

Fields inherited from class org.apache.lucene.index.IndexReader
`hasChanges`

Constructor Summary
`InstantiatedIndexReader(InstantiatedIndex index)`

Method Summary
`Directory` `directory()`
`int` `docFreq(Term t)`
`protected void` `doClose()`
`protected void` `doCommit()`
`Document` `document(int n)` Returns the stored fields of the `n`th `Document` in this index.
`Document` `document(int n, FieldSelector fieldSelector)` Return the `Document` at the `n`th position.
`protected void` `doDelete(int docNum)`
`protected void` `doSetNorm(int doc, String field, byte value)`
`protected void` `doUndeleteAll()`
`Collection` `getFieldNames(IndexReader.FieldOption fieldOption)`
`InstantiatedIndex` `getIndex()`
`TermFreqVector` `getTermFreqVector(int docNumber, String field)`
`void` `getTermFreqVector(int docNumber, String field, TermVectorMapper mapper)`
`void` `getTermFreqVector(int docNumber, TermVectorMapper mapper)`
`TermFreqVector[]` `getTermFreqVectors(int docNumber)`
`long` `getVersion()` An InstantiatedIndexReader is not a snapshot in time, it is completely in sync with the latest commit to the store!
`boolean` `hasDeletions()`
`boolean` `isCurrent()` An InstantiatedIndexReader is always current! Check whether this IndexReader is still using the current (i.e., most recently committed) version of the index.
`boolean` `isDeleted(int n)`
`boolean` `isOptimized()`
`int` `maxDoc()`
`byte[]` `norms(String field)` never ever touch these values.
`void` `norms(String field, byte[] bytes, int offset)`
`int` `numDocs()`
`TermDocs` `termDocs()`
`TermPositions` `termPositions()`
`TermEnum` `terms()`
`TermEnum` `terms(Term t)`

Methods inherited from class org.apache.lucene.index.IndexReader

`acquireWriteLock, close, commit, decRef, deleteDocument, deleteDocuments, ensureOpen, flush, getCurrentVersion, getCurrentVersion, getCurrentVersion, getIndexCommit, getTermInfosIndexDivisor, hasNorms, incRef, indexExists, indexExists, indexExists, isLocked, isLocked, lastModified, lastModified, lastModified, listCommits, main, numDeletedDocs, open, open, open, open, open, open, open, open, open, reopen, setNorm, setNorm, setTermInfosIndexDivisor, termDocs, termPositions, undeleteAll, unlock`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### InstantiatedIndexReader

    public InstantiatedIndexReader(InstantiatedIndex index)

Method Detail

### isOptimized

    public boolean isOptimized()

  Overrides:
    `isOptimized` in class `IndexReader`
  Returns:
    always true.

### getVersion

    public long getVersion()

  An InstantiatedIndexReader is not a snapshot in time, it is completely in sync with the latest commit to the store!

  Overrides:
    `getVersion` in class `IndexReader`
  Returns:
    output from `InstantiatedIndex.getVersion()` in associated instantiated index.

### directory

    public Directory directory()

  Overrides:
    `directory` in class `IndexReader`

### isCurrent

    public boolean isCurrent()
                      throws IOException

  An InstantiatedIndexReader is always current! 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.

  Overrides:
    `isCurrent` in class `IndexReader`
  Returns:
    always true
  Throws:
    `CorruptIndexException` - if the index is corrupt
    `IOException` - if there is a low-level IO error
    `UnsupportedOperationException` - unless overridden in subclass

### getIndex

    public InstantiatedIndex getIndex()

### numDocs

    public int numDocs()

  Specified by:
    `numDocs` in class `IndexReader`

### maxDoc

    public int maxDoc()

  Specified by:
    `maxDoc` in class `IndexReader`

### isDeleted

    public boolean isDeleted(int n)

  Specified by:
    `isDeleted` in class `IndexReader`

### hasDeletions

    public boolean hasDeletions()

  Specified by:
    `hasDeletions` in class `IndexReader`

### doDelete

    protected void doDelete(int docNum)
                     throws IOException

  Specified by:
    `doDelete` in class `IndexReader`
  Throws:
    `IOException`

### doUndeleteAll

    protected void doUndeleteAll()
                          throws IOException

  Specified by:
    `doUndeleteAll` in class `IndexReader`
  Throws:
    `IOException`

### doCommit

    protected void doCommit()
                     throws IOException

  Specified by:
    `doCommit` in class `IndexReader`
  Throws:
    `IOException`

### doClose

    protected void doClose()
                    throws IOException

  Specified by:
    `doClose` in class `IndexReader`
  Throws:
    `IOException`

### getFieldNames

    public Collection getFieldNames(IndexReader.FieldOption fieldOption)

  Specified by:
    `getFieldNames` in class `IndexReader`

### document

    public Document document(int n,
                             FieldSelector fieldSelector)
                      throws CorruptIndexException,
                             IOException

  Return the `Document` at the `n`th position.

  Warning! The resulting document is the actual stored document instance and not a deserialized clone as retuned by an IndexReader over a `Directory`. I.e., if you need to touch the document, clone it first!

  This can also be seen as a feature for live canges of stored values, but be carful! Adding a field with an name unknown to the index or to a field with previously no stored values will make `getFieldNames(org.apache.lucene.index.IndexReader.FieldOption)` out of sync, causing problems for instance when merging the instantiated index to another index.

  This implementation ignores the field selector! All stored fields are always returned!

  Specified by:
    `document` in class `IndexReader`
  Parameters:
    `n` - document number
    `fieldSelector` - ignored
  Returns:
    The stored fields of the `Document` at the nth position
  Throws:
    `CorruptIndexException` - if the index is corrupt
    `IOException` - if there is a low-level IO error
  See Also:
    `Fieldable`, `FieldSelector`, `SetBasedFieldSelector`, `LoadFirstFieldSelector`

### document

    public Document document(int n)
                      throws IOException

  Returns the stored fields of the `n`th `Document` in this index.

  Warning! The resulting document is the actual stored document instance and not a deserialized clone as retuned by an IndexReader over a `Directory`. I.e., if you need to touch the document, clone it first!

  This can also be seen as a feature for live canges of stored values, but be carful! Adding a field with an name unknown to the index or to a field with previously no stored values will make `getFieldNames(org.apache.lucene.index.IndexReader.FieldOption)` out of sync, causing problems for instance when merging the instantiated index to another index.

  Overrides:
    `document` in class `IndexReader`
  Throws:
    `CorruptIndexException` - if the index is corrupt
    `IOException` - if there is a low-level IO error

### norms

    public byte[] norms(String field)
                 throws IOException

  never ever touch these values. it is the true values, unless norms have been touched.

  Specified by:
    `norms` in class `IndexReader`
  Throws:
    `IOException`

### norms

    public void norms(String field,
                      byte[] bytes,
                      int offset)
               throws IOException

  Specified by:
    `norms` in class `IndexReader`
  Throws:
    `IOException`

### doSetNorm

    protected void doSetNorm(int doc,
                             String field,
                             byte value)
                      throws IOException

  Specified by:
    `doSetNorm` in class `IndexReader`
  Throws:
    `IOException`

### docFreq

    public int docFreq(Term t)
                throws IOException

  Specified by:
    `docFreq` in class `IndexReader`
  Throws:
    `IOException`

### terms

    public TermEnum terms()
                   throws IOException

  Specified by:
    `terms` in class `IndexReader`
  Throws:
    `IOException`

### terms

    public TermEnum terms(Term t)
                   throws IOException

  Specified by:
    `terms` in class `IndexReader`
  Throws:
    `IOException`

### termDocs

    public TermDocs termDocs()
                      throws IOException

  Specified by:
    `termDocs` in class `IndexReader`
  Throws:
    `IOException`

### termPositions

    public TermPositions termPositions()
                                throws IOException

  Specified by:
    `termPositions` in class `IndexReader`
  Throws:
    `IOException`

### getTermFreqVectors

    public TermFreqVector[] getTermFreqVectors(int docNumber)
                                        throws IOException

  Specified by:
    `getTermFreqVectors` in class `IndexReader`
  Throws:
    `IOException`

### getTermFreqVector

    public TermFreqVector getTermFreqVector(int docNumber,
                                            String field)
                                     throws IOException

  Specified by:
    `getTermFreqVector` in class `IndexReader`
  Throws:
    `IOException`

### getTermFreqVector

    public void getTermFreqVector(int docNumber,
                                  String field,
                                  TermVectorMapper mapper)
                           throws IOException

  Specified by:
    `getTermFreqVector` in class `IndexReader`
  Throws:
    `IOException`

### getTermFreqVector

    public void getTermFreqVector(int docNumber,
                                  TermVectorMapper mapper)
                           throws IOException

  Specified by:
    `getTermFreqVector` in class `IndexReader`
  Throws:
    `IOException`

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