org.apache.solr.update

## Class DirectUpdateHandler2

- java.lang.Object
- - org.apache.solr.update.UpdateHandler
  - - org.apache.solr.update.DirectUpdateHandler2

- All Implemented Interfaces:
    SolrInfoMBean, SolrCoreState.IndexWriterCloser

      public class DirectUpdateHandler2
      extends UpdateHandler
      implements SolrCoreState.IndexWriterCloser

  `DirectUpdateHandler2` implements an UpdateHandler where documents are added directly to the main Lucene index as opposed to adding to a separate smaller index.

  TODO: add soft commitWithin support

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoMBean

      `SolrInfoMBean.Category`

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static boolean` | `commitOnClose`
    `protected CommitTracker` | `commitTracker`
    `protected boolean` | `commitWithinSoftCommit`
    `protected boolean` | `indexWriterCloseWaitsForMerges`
    `protected CommitTracker` | `softCommitTracker`
    `protected SolrCoreState` | `solrCoreState`

    - ### Fields inherited from class org.apache.solr.update.UpdateHandler

      `commitCallbacks, core, idField, idFieldType, optimizeCallbacks, softCommitCallbacks, ulog`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DirectUpdateHandler2(SolrCore core)`
    `DirectUpdateHandler2(SolrCore core, UpdateHandler updateHandler)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `addDoc(AddUpdateCommand cmd)`
    `void` | `clearIndex()`
    `void` | `close()`
    `void` | `closeWriter(IndexWriter writer)`
    `void` | `commit(CommitUpdateCommand cmd)`
    `void` | `delete(DeleteUpdateCommand cmd)`
    `void` | `deleteByQuery(DeleteUpdateCommand cmd)`
    `SolrInfoMBean.Category` | `getCategory()` Purpose of this Class
    `CommitTracker` | `getCommitTracker()`
    `String` | `getDescription()` Simple one or two line description
    `URL[]` | `getDocs()` Documentation URL list.
    `String` | `getName()` Simple common usage name, e.g.
    `CommitTracker` | `getSoftCommitTracker()`
    `SolrCoreState` | `getSolrCoreState()`
    `String` | `getSource()` CVS Source, SVN Source, etc
    `NamedList` | `getStatistics()` Any statistics this instance would like to be publicly available via the Solr Administration interface.
    `UpdateLog` | `getUpdateLog()`
    `String` | `getVersion()` Simple common usage version, e.g.
    `int` | `mergeIndexes(MergeIndexesCommand cmd)`
    `void` | `newIndexWriter(boolean rollback)` Called when the Writer should be opened again - eg when replication replaces all of the index files.
    `void` | `prepareCommit(CommitUpdateCommand cmd)`
    `void` | `rollback(RollbackUpdateCommand cmd)`
    `protected void` | `rollbackWriter()`
    `void` | `split(SplitIndexCommand cmd)`
    `String` | `toString()`

    - ### Methods inherited from class org.apache.solr.update.UpdateHandler

      `callPostCommitCallbacks, callPostOptimizeCallbacks, callPostSoftCommitCallbacks, registerCommitCallback, registerOptimizeCallback, registerSoftCommitCallback`

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

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

- - ### Field Detail

    - #### solrCoreState

          protected final SolrCoreState solrCoreState

    - #### commitTracker

          protected final CommitTracker commitTracker

    - #### softCommitTracker

          protected final CommitTracker softCommitTracker

    - #### commitWithinSoftCommit

          protected boolean commitWithinSoftCommit

    - #### indexWriterCloseWaitsForMerges

          protected boolean indexWriterCloseWaitsForMerges

    - #### commitOnClose

          public static boolean commitOnClose

  - ### Constructor Detail

    - #### DirectUpdateHandler2

          public DirectUpdateHandler2(SolrCore core)

    - #### DirectUpdateHandler2

          public DirectUpdateHandler2(SolrCore core,
                                      UpdateHandler updateHandler)

  - ### Method Detail

    - #### rollbackWriter

          protected void rollbackWriter()
                                 throws IOException

      Throws:
        `IOException`

    - #### addDoc

          public int addDoc(AddUpdateCommand cmd)
                     throws IOException

      Specified by:
        `addDoc` in class `UpdateHandler`
      Throws:
        `IOException`

    - #### delete

          public void delete(DeleteUpdateCommand cmd)
                      throws IOException

      Specified by:
        `delete` in class `UpdateHandler`
      Throws:
        `IOException`

    - #### clearIndex

          public void clearIndex()
                          throws IOException

      Throws:
        `IOException`

    - #### deleteByQuery

          public void deleteByQuery(DeleteUpdateCommand cmd)
                             throws IOException

      Specified by:
        `deleteByQuery` in class `UpdateHandler`
      Throws:
        `IOException`

    - #### mergeIndexes

          public int mergeIndexes(MergeIndexesCommand cmd)
                           throws IOException

      Specified by:
        `mergeIndexes` in class `UpdateHandler`
      Throws:
        `IOException`

    - #### prepareCommit

          public void prepareCommit(CommitUpdateCommand cmd)
                             throws IOException

      Throws:
        `IOException`

    - #### commit

          public void commit(CommitUpdateCommand cmd)
                      throws IOException

      Specified by:
        `commit` in class `UpdateHandler`
      Throws:
        `IOException`

    - #### newIndexWriter

          public void newIndexWriter(boolean rollback)
                              throws IOException

      Description copied from class: `UpdateHandler`
      Called when the Writer should be opened again - eg when replication replaces all of the index files.
      Specified by:
        `newIndexWriter` in class `UpdateHandler`
      Parameters:
        `rollback` - IndexWriter if true else close
      Throws:
        `IOException` - If there is a low-level I/O error.

    - #### rollback

          public void rollback(RollbackUpdateCommand cmd)
                        throws IOException

      Specified by:
        `rollback` in class `UpdateHandler`
      Throws:
        `IOException`
      Since:
        Solr 1.4

    - #### getUpdateLog

          public UpdateLog getUpdateLog()

      Specified by:
        `getUpdateLog` in class `UpdateHandler`

    - #### close

          public void close()
                     throws IOException

      Specified by:
        `close` in class `UpdateHandler`
      Throws:
        `IOException`

    - #### closeWriter

          public void closeWriter(IndexWriter writer)
                           throws IOException

      Specified by:
        `closeWriter` in interface `SolrCoreState.IndexWriterCloser`
      Throws:
        `IOException`

    - #### split

          public void split(SplitIndexCommand cmd)
                     throws IOException

      Specified by:
        `split` in class `UpdateHandler`
      Throws:
        `IOException`

    - #### getName

          public String getName()

      Description copied from interface: `SolrInfoMBean`
      Simple common usage name, e.g. BasicQueryHandler, or fully qualified clas name.
      Specified by:
        `getName` in interface `SolrInfoMBean`

    - #### getVersion

          public String getVersion()

      Description copied from interface: `SolrInfoMBean`
      Simple common usage version, e.g. 2.0
      Specified by:
        `getVersion` in interface `SolrInfoMBean`

    - #### getDescription

          public String getDescription()

      Description copied from interface: `SolrInfoMBean`
      Simple one or two line description
      Specified by:
        `getDescription` in interface `SolrInfoMBean`

    - #### getCategory

          public SolrInfoMBean.Category getCategory()

      Description copied from interface: `SolrInfoMBean`
      Purpose of this Class
      Specified by:
        `getCategory` in interface `SolrInfoMBean`

    - #### getSource

          public String getSource()

      Description copied from interface: `SolrInfoMBean`
      CVS Source, SVN Source, etc
      Specified by:
        `getSource` in interface `SolrInfoMBean`

    - #### getDocs

          public URL[] getDocs()

      Description copied from interface: `SolrInfoMBean`
      Documentation URL list.

      Suggested documentation URLs: Homepage for sponsoring project, FAQ on class usage, Design doc for class, Wiki, bug reporting URL, etc...

      Specified by:
        `getDocs` in interface `SolrInfoMBean`

    - #### getStatistics

          public NamedList getStatistics()

      Description copied from interface: `SolrInfoMBean`
      Any statistics this instance would like to be publicly available via the Solr Administration interface.

      Any Object type may be stored in the list, but only the `toString()` representation will be used.

      Specified by:
        `getStatistics` in interface `SolrInfoMBean`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### getSolrCoreState

          public SolrCoreState getSolrCoreState()

      Specified by:
        `getSolrCoreState` in class `UpdateHandler`

    - #### getCommitTracker

          public CommitTracker getCommitTracker()

    - #### getSoftCommitTracker

          public CommitTracker getSoftCommitTracker()

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