org.apache.solr.client.solrj.impl

Class HttpSolrClient

  • All Implemented Interfaces:
    Closeable, Serializable, AutoCloseable
    Direct Known Subclasses:
    DelegationTokenHttpSolrClient


    public class HttpSolrClient
    extends SolrClient
    A SolrClient implementation that talks directly to a Solr server via HTTP There are two ways to use an HttpSolrClient: 1) Pass a URL to the constructor that points directly at a particular core
       SolrClient client = new HttpSolrClient("http://my-solr-server:8983/solr/core1");
       QueryResponse resp = client.query(new SolrQuery("*:*"));
     
    In this case, you can query the given core directly, but you cannot query any other cores or issue CoreAdmin requests with this client. 2) Pass the base URL of the node to the constructor
       SolrClient client = new HttpSolrClient("http://my-solr-server:8983/solr");
       QueryResponse resp = client.query("core1", new SolrQuery("*:*"));
     
    In this case, you must pass the name of the required core for all queries and updates, but you may use the same client for all cores, and for CoreAdmin requests.
    See Also:
    Serialized Form