org.apache.solr.handler.dataimport

## Class SolrWriter

- java.lang.Object
- - org.apache.solr.handler.dataimport.DIHWriterBase
  - - org.apache.solr.handler.dataimport.SolrWriter

- All Implemented Interfaces:
    DIHWriter

      public class SolrWriter
      extends DIHWriterBase
      implements DIHWriter

  Writes documents to SOLR.

  This API is experimental and may change in the future.

  Since:
    solr 1.3

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static String` | `LAST_INDEX_KEY`

    - ### Fields inherited from class org.apache.solr.handler.dataimport.DIHWriterBase

      `deltaKeys, keyFieldName`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SolrWriter(UpdateRequestProcessor processor, SolrQueryRequest req)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Release resources used by this writer.
    `void` | `commit(boolean optimize)` If this writer supports transactions or commit points, then commit any changes, optionally optimizing the data for read/write performance
    `void` | `deleteByQuery(String query)` Delete from the writer's underlying data store based the passed-in writer-specific query.
    `void` | `deleteDoc(Object id)` Delete from the writer's underlying data store based on the passed-in Primary Key
    `void` | `doDeleteAll()` Delete everything from the writer's underlying data store
    `void` | `init(Context context)` Provide context information for this writer.
    `void` | `rollback()` If this writer supports transactions or commit points, then roll back any uncommitted changes.
    `boolean` | `upload(SolrInputDocument d)` Add a document to this writer's underlying data store.

    - ### Methods inherited from class org.apache.solr.handler.dataimport.DIHWriterBase

      `setDeltaKeys`

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

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

    - ### Methods inherited from interface org.apache.solr.handler.dataimport.DIHWriter

      `setDeltaKeys`

- - ### Field Detail

    - #### LAST_INDEX_KEY

          public static final String LAST_INDEX_KEY

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SolrWriter

          public SolrWriter(UpdateRequestProcessor processor,
                            SolrQueryRequest req)

  - ### Method Detail

    - #### close

          public void close()

      Description copied from interface: `DIHWriter`

      Release resources used by this writer. After calling close, reads & updates will throw exceptions.

      Specified by:
        `close` in interface `DIHWriter`

    - #### upload

          public boolean upload(SolrInputDocument d)

      Description copied from interface: `DIHWriter`

      Add a document to this writer's underlying data store.

      Specified by:
        `upload` in interface `DIHWriter`
      Returns:
        true on success, false on failure

    - #### deleteDoc

          public void deleteDoc(Object id)

      Description copied from interface: `DIHWriter`

      Delete from the writer's underlying data store based on the passed-in Primary Key

      Specified by:
        `deleteDoc` in interface `DIHWriter`

    - #### deleteByQuery

          public void deleteByQuery(String query)

      Description copied from interface: `DIHWriter`

      Delete from the writer's underlying data store based the passed-in writer-specific query. (Optional Operation)

      Specified by:
        `deleteByQuery` in interface `DIHWriter`

    - #### commit

          public void commit(boolean optimize)

      Description copied from interface: `DIHWriter`

      If this writer supports transactions or commit points, then commit any changes, optionally optimizing the data for read/write performance

      Specified by:
        `commit` in interface `DIHWriter`

    - #### rollback

          public void rollback()

      Description copied from interface: `DIHWriter`

      If this writer supports transactions or commit points, then roll back any uncommitted changes.

      Specified by:
        `rollback` in interface `DIHWriter`

    - #### doDeleteAll

          public void doDeleteAll()

      Description copied from interface: `DIHWriter`

      Delete everything from the writer's underlying data store

      Specified by:
        `doDeleteAll` in interface `DIHWriter`

    - #### init

          public void init(Context context)

      Description copied from interface: `DIHWriter`

      Provide context information for this writer. init() should be called before using the writer.

      Specified by:
        `init` in interface `DIHWriter`

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