org.apache.solr.servlet

## Class DirectSolrConnection

- java.lang.Object
- - org.apache.solr.servlet.DirectSolrConnection

-     public class DirectSolrConnection
      extends Object

  DirectSolrConnection provides an interface to Solr that is similar to the the HTTP interface, but does not require an HTTP connection. This class is designed to be as simple as possible and allow for more flexibility in how you interface to Solr.
  Since:
    solr 1.2

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected SolrCore` | `core`
    `protected SolrRequestParsers` | `parser`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DirectSolrConnection(SolrCore c)` Initialize using an explicit SolrCore

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Use this method to close the underlying SolrCore.
    `String` | `request(SolrRequestHandler handler, SolrParams params, String body)`
    `String` | `request(String path, SolrParams params, String body)`
    `String` | `request(String pathAndParams, String body)` For example: String json = solr.request( "/select?qt=dismax&wt=json&q=...", null ); String xml = solr.request( "/update", "<add><doc><field ..." );

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

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

- - ### Field Detail

    - #### core

          protected final SolrCore core

    - #### parser

          protected final SolrRequestParsers parser

  - ### Constructor Detail

    - #### DirectSolrConnection

          public DirectSolrConnection(SolrCore c)

      Initialize using an explicit SolrCore

  - ### Method Detail

    - #### request

          public String request(String pathAndParams,
                                String body)
                         throws Exception

      For example: String json = solr.request( "/select?qt=dismax&wt=json&q=...", null ); String xml = solr.request( "/update", "<add><doc><field ..." );
      Throws:
        `Exception`

    - #### request

          public String request(String path,
                                SolrParams params,
                                String body)
                         throws Exception

      Throws:
        `Exception`

    - #### request

          public String request(SolrRequestHandler handler,
                                SolrParams params,
                                String body)
                         throws Exception

      Throws:
        `Exception`

    - #### close

          public void close()

      Use this method to close the underlying SolrCore.
      Since:
        solr 1.3

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