DirectUpdateHandler2 (Solr 3.6.2 API)
Keywords: org.apache.solr.update.DirectUpdateHandler2 class

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.solr.update
Class DirectUpdateHandler2

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

All Implemented Interfaces:
  SolrInfoMBean

    public class DirectUpdateHandler2

extends UpdateHandler

`DirectUpdateHandler2` implements an UpdateHandler where documents are added directly to the main Lucene index as opposed to adding to a separate smaller index. For this reason, not all combinations to/from pending and committed are supported. This version supports efficient removal of duplicates on a commit. It works by maintaining a related count for every document being added or deleted. At commit time, for every id with a count, all but the last "count" docs with that id are deleted.

Supported add command parameters:

allowDups | overwritePending | overwriteCommitted | efficiency
--- | --- | --- | ---
false | false | true | fast
true or false | true | true | fast
true | false | false | fastest

Supported delete commands:

command | fromPending | fromCommitted | efficiency
--- | --- | --- | ---
delete | true | true | fast
deleteByQuery | true | true | very slow*

* deleteByQuery causes a commit to happen (close current index writer, open new index reader) before it can be processed. If deleteByQuery functionality is needed, it's best if they can be batched and executed together so they may share the same index reader.

Since:
  solr 0.9
Version:
  $Id: DirectUpdateHandler2.java 1297074 2012-03-05 14:40:17Z uschindler $

Nested Class Summary

Nested classes/interfaces inherited from interface org.apache.solr.core.SolrInfoMBean
`SolrInfoMBean.Category`

Field Summary
`protected org.apache.solr.update.CommitTracker` | `commitTracker`
`protected Lock` | `iwAccess`
`protected Lock` | `iwCommit`
`protected IndexWriter` | `writer`

Fields inherited from class org.apache.solr.update.UpdateHandler
`commitCallbacks, core, idField, idFieldType, idTerm, log, optimizeCallbacks, schema`

Constructor Summary
`DirectUpdateHandler2(SolrCore core)`

Method Summary
`int` | `addDoc(AddUpdateCommand cmd)`
`void` | `close()`
`protected void` | `closeWriter()`
`void` | `commit(CommitUpdateCommand cmd)`
`void` | `delete(DeleteUpdateCommand cmd)`
`void` | `deleteByQuery(DeleteUpdateCommand cmd)`
`void` | `forceOpenWriter()`
`SolrInfoMBean.Category` | `getCategory()` Purpose of this Class
`String` | `getDescription()` Simple one or two line description
`URL[]` | `getDocs()` Documentation URL list.
`String` | `getName()` Simple common usage name, e.g.
`String` | `getSource()` CVS Source, SVN Source, etc
`String` | `getSourceId()` CVS Id, SVN Id, etc
`NamedList` | `getStatistics()` Any statistics this instance would like to be publicly available via the Solr Administration interface.
`String` | `getVersion()` Simple common usage version, e.g.
`int` | `mergeIndexes(MergeIndexesCommand cmd)`
`protected void` | `openWriter()`
`void` | `rollback(RollbackUpdateCommand cmd)`
`protected void` | `rollbackWriter()`
`String` | `toString()`

Methods inherited from class org.apache.solr.update.UpdateHandler
`callPostCommitCallbacks, callPostOptimizeCallbacks, createMainIndexWriter, getIndexedId, getIndexedIdOptional, idTerm, registerCommitCallback, registerOptimizeCallback`

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

Field Detail

### commitTracker

    protected final org.apache.solr.update.CommitTracker commitTracker

### iwAccess

    protected final Lock iwAccess

### iwCommit

    protected final Lock iwCommit

### writer

    protected IndexWriter writer

Constructor Detail

### DirectUpdateHandler2

    public DirectUpdateHandler2(SolrCore core)
                         throws IOException

Throws:
  `IOException`

Method Detail

### openWriter

    protected void openWriter()
                       throws IOException

  Throws:
    `IOException`

### closeWriter

    protected void closeWriter()
                        throws IOException

  Throws:
    `IOException`

### 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`

### 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`

### forceOpenWriter

    public void forceOpenWriter()
                         throws IOException

  Throws:
    `IOException`

### commit

    public void commit(CommitUpdateCommand cmd)
                throws IOException

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

### rollback

    public void rollback(RollbackUpdateCommand cmd)
                  throws IOException

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

### close

    public void close()
               throws IOException

  Specified by:
    `close` 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.

### getVersion

    public String getVersion()

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

### getDescription

    public String getDescription()

  Description copied from interface: `SolrInfoMBean`
  Simple one or two line description

### getCategory

    public SolrInfoMBean.Category getCategory()

  Description copied from interface: `SolrInfoMBean`
  Purpose of this Class

### getSourceId

    public String getSourceId()

  Description copied from interface: `SolrInfoMBean`
  CVS Id, SVN Id, etc

### getSource

    public String getSource()

  Description copied from interface: `SolrInfoMBean`
  CVS Source, SVN Source, etc

### 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...

### 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.

### toString

    public String toString()

  Overrides:
    `toString` in class `Object`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD