Class DirectSolrConnection


  • public class DirectSolrConnection
    extends Object
    DirectSolrConnection provides an interface to Solr that is similar to 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
    • 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( "/select?qt=dismax&wt=xml&q=...", null ); String xml = solr.request( "/update", "<add><doc><field ..." );

        Throws:
        Exception
      • close

        public void close()
        Use this method to close the underlying SolrCore.
        Since:
        solr 1.3