org.apache.solr.core

## Class IndexReaderFactory

- java.lang.Object
- - org.apache.solr.core.IndexReaderFactory

- All Implemented Interfaces:
    NamedListInitializedPlugin
  Direct Known Subclasses:
    StandardIndexReaderFactory

      public abstract class IndexReaderFactory
      extends Object
      implements NamedListInitializedPlugin

  Factory used to build a new IndexReader instance.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `IndexReaderFactory()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `init(NamedList args)` init will be called just once, immediately after creation.
    `abstract DirectoryReader` | `newReader(Directory indexDir, SolrCore core)` Creates a new IndexReader instance using the given Directory.
    `abstract DirectoryReader` | `newReader(IndexWriter writer, SolrCore core)` Creates a new IndexReader instance using the given IndexWriter.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### IndexReaderFactory

          public IndexReaderFactory()

  - ### Method Detail

    - #### init

          public void init(NamedList args)

      init will be called just once, immediately after creation.

      The args are user-level initialization parameters that may be specified when declaring an indexReaderFactory in solrconfig.xml

      Specified by:
        `init` in interface `NamedListInitializedPlugin`

    - #### newReader

          public abstract DirectoryReader newReader(Directory indexDir,
                                                    SolrCore core)
                                             throws IOException

      Creates a new IndexReader instance using the given Directory.
      Parameters:
        `indexDir` - indexDir index location
        `core` - `SolrCore` instance where this reader will be used. NOTE: this SolrCore instance may not be fully configured yet, but basic things like `SolrCore.getCoreDescriptor()`, `SolrCore.getLatestSchema()` and `SolrCore.getSolrConfig()` are valid.
      Returns:
        An IndexReader instance
      Throws:
        `IOException` - If there is a low-level I/O error.

    - #### newReader

          public abstract DirectoryReader newReader(IndexWriter writer,
                                                    SolrCore core)
                                             throws IOException

      Creates a new IndexReader instance using the given IndexWriter.

      This is used for opening the initial reader in NRT mode

      Parameters:
        `writer` - IndexWriter
        `core` - `SolrCore` instance where this reader will be used. NOTE: this SolrCore instance may not be fully configured yet, but basic things like `SolrCore.getCoreDescriptor()`, `SolrCore.getLatestSchema()` and `SolrCore.getSolrConfig()` are valid.
      Returns:
        An IndexReader instance
      Throws:
        `IOException` - If there is a low-level I/O error.

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