Class RemoteSolrBackend

java.lang.Object
org.apache.solr.cloud.RemoteSolrBackend
All Implemented Interfaces:
AutoCloseable, SolrBackend

public class RemoteSolrBackend extends Object implements SolrBackend
SolrBackend that connects to a pre-existing remote SolrCloud cluster. The caller supplies the HTTP connection string at construction time (e.g. http://localhost:8983/solr).
  • Constructor Details

    • RemoteSolrBackend

      public RemoteSolrBackend(String baseUrl)
  • Method Details

    • getCoreContainer

      public org.apache.solr.core.CoreContainer getCoreContainer()
      Description copied from interface: SolrBackend
      Provides access to an embedded/in-process CoreContainer -- if available (else null). If there is more than one node, then one is returned.
      Specified by:
      getCoreContainer in interface SolrBackend
      Returns:
      can be null.
    • newSolrClient

      public org.apache.solr.client.solrj.SolrClient newSolrClient(String collection)
      Description copied from interface: SolrBackend
      Creates a new SolrClient defaulted to the given collection. The caller owns this client and is responsible for closing it. Callers that want a long-lived client should cache it themselves.
      Specified by:
      newSolrClient in interface SolrBackend
    • getSolrClient

      public org.apache.solr.client.solrj.SolrClient getSolrClient()
      Description copied from interface: SolrBackend
      Returns the node / admin (collection-less) SolrClient owned by this backend. The caller must NOT close it; it is released when this backend is SolrBackend.close()d. A CloudSolrClient should be returned if appropriate. While it *can* be used to target specific collections, please use SolrBackend.newSolrClient(String) for that instead.
      Specified by:
      getSolrClient in interface SolrBackend
    • uploadConfigSet

      public void uploadConfigSet(Path configDir, String name) throws org.apache.solr.client.solrj.SolrServerException, IOException
      Description copied from interface: SolrBackend
      Upload a configSet, possibly overwriting (creating files, updating files, NOT deleting files).
      Specified by:
      uploadConfigSet in interface SolrBackend
      Parameters:
      configDir - a path to the config set to upload
      name - the name to give the configSet
      Throws:
      org.apache.solr.client.solrj.SolrServerException
      IOException
    • hasConfigSet

      public boolean hasConfigSet(String name) throws org.apache.solr.client.solrj.SolrServerException, IOException
      Description copied from interface: SolrBackend
      Checks if a configSet with the given name exists.
      Specified by:
      hasConfigSet in interface SolrBackend
      Parameters:
      name - configSet name to check
      Returns:
      true if the configSet exists, false otherwise
      Throws:
      org.apache.solr.client.solrj.SolrServerException
      IOException
    • createCollection

      public void createCollection(org.apache.solr.client.solrj.request.CollectionAdminRequest.Create create) throws org.apache.solr.client.solrj.SolrServerException, IOException
      Description copied from interface: SolrBackend
      Creates a collection (or core for single-node backends). Cloud backends honour numShards and replicationFactor; single-node backends (JettySolrRunner, EmbeddedSolrBackend) ignore those fields. Callers should use SolrBackend.hasCollection(String) first if they want to avoid errors when the collection already exists. Tests/benchmarks that want to test how this works should not use this to do so.
      Specified by:
      createCollection in interface SolrBackend
      Throws:
      org.apache.solr.client.solrj.SolrServerException
      IOException
    • hasCollection

      public boolean hasCollection(String name) throws org.apache.solr.client.solrj.SolrServerException, IOException
      Description copied from interface: SolrBackend
      Checks if a collection or core with the given name exists.
      Specified by:
      hasCollection in interface SolrBackend
      Parameters:
      name - collection or core name to check
      Returns:
      true if the collection/core exists, false otherwise
      Throws:
      org.apache.solr.client.solrj.SolrServerException
      IOException
    • close

      public void close()
      Description copied from interface: SolrBackend
      Shuts down this backend, releases the admin client, and all other resources.
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface SolrBackend