DirectSolrConnection (Solr 3.6.2 API)
Keywords: org.apache.solr.servlet.DirectSolrConnection 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.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
Version:
  $Id: DirectSolrConnection.java 1232343 2012-01-17 08:54:32Z simonw $

Constructor Summary
`DirectSolrConnection()` Deprecated. use `DirectSolrConnection(SolrCore)`
`DirectSolrConnection(SolrCore c)` Initialize using an explicit SolrCore
`DirectSolrConnection(String instanceDir, String dataDir, String loggingPath)` This constructor is designed to make it easy for JNI embedded applications to setup the entire solr environment with a simple interface.

Method Summary
`void` | `close()` Use this method to close the underlying SolrCore.
`String` | `request(SolrRequestHandler handler, 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>

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

Constructor Detail

### DirectSolrConnection

    @Deprecated
    public DirectSolrConnection()

  Deprecated. use `DirectSolrConnection(SolrCore)`

  Initialize using the static singleton SolrCore.getSolrCore().

### DirectSolrConnection

    public DirectSolrConnection(SolrCore c)

  Initialize using an explicit SolrCore

### DirectSolrConnection

    public DirectSolrConnection(String instanceDir,
                                String dataDir,
                                String loggingPath)

  This constructor is designed to make it easy for JNI embedded applications to setup the entire solr environment with a simple interface. It takes three parameters: `instanceDir:` The solr instance directory. If null, it will check the standard places first (JNDI,properties,"solr" directory) `dataDir:` where the index is stored. `loggingPath:` Path to a java.util.logging.config.file. If the path represents an absolute path or is relative to the CWD, it will use that. Next it will try a path relative to the instanceDir. If none of these files exist, it will error.

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

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