Class CloudSolrClient
- java.lang.Object
-
- org.apache.solr.client.solrj.SolrClient
-
- org.apache.solr.client.solrj.impl.BaseCloudSolrClient
-
- org.apache.solr.client.solrj.impl.CloudSolrClient
-
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
public class CloudSolrClient extends BaseCloudSolrClient
SolrJ client class to communicate with SolrCloud. Instances of this class communicate with Zookeeper to discover Solr endpoints for SolrCloud collections, and then use theLBHttpSolrClient
to issue requests. This class assumes the id field for your documents is called 'id' - if this is not the case, you must set the right name withBaseCloudSolrClient.setIdField(String)
.- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CloudSolrClient.Builder
ConstructsCloudSolrClient
instances from provided configuration.static class
CloudSolrClient.RouteException
Deprecated.since Solr 8.0static class
CloudSolrClient.RouteResponse
Deprecated.since Solr 8.0
-
Field Summary
Fields Modifier and Type Field Description static String
STATE_VERSION
-
Fields inherited from class org.apache.solr.client.solrj.impl.BaseCloudSolrClient
collectionStateCache
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
CloudSolrClient(CloudSolrClient.Builder builder)
Create a new client object that connects to Zookeeper and is always aware of the SolrCloud state.
-
Method Summary
-
Methods inherited from class org.apache.solr.client.solrj.impl.BaseCloudSolrClient
condenseResponse, connect, connect, getDefaultCollection, getDocCollection, getIdField, getMinAchievedReplicationFactor, getParser, getRequestWriter, getShardReplicationFactor, getZkHost, getZkStateReader, isDirectUpdatesToLeadersOnly, isParallelUpdates, isUpdatesToLeaders, objectList, registerCollectionStateWatcher, request, requestWithRetryOnStaleState, sendRequest, setCollectionCacheTTl, setDefaultCollection, setIdField, setParallelCacheRefreshes, setParser, setRequestWriter, setRetryExpiryTime, setZkClientTimeout, setZkConnectTimeout, waitForState
-
Methods inherited from class org.apache.solr.client.solrj.SolrClient
add, add, add, add, add, add, add, add, add, add, addBean, addBean, addBean, addBean, addBeans, addBeans, addBeans, addBeans, addBeans, addBeans, commit, commit, commit, commit, commit, commit, deleteById, deleteById, deleteById, deleteById, deleteById, deleteById, deleteById, deleteById, deleteByQuery, deleteByQuery, deleteByQuery, deleteByQuery, getBinder, getById, getById, getById, getById, getById, getById, getById, getById, optimize, optimize, optimize, optimize, optimize, optimize, ping, query, query, query, query, queryAndStreamResponse, queryAndStreamResponse, queryAndStreamResponse, request, rollback, rollback
-
-
-
-
Field Detail
-
STATE_VERSION
public static final String STATE_VERSION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CloudSolrClient
protected CloudSolrClient(CloudSolrClient.Builder builder)
Create a new client object that connects to Zookeeper and is always aware of the SolrCloud state. If there is a fully redundant Zookeeper quorum and SolrCloud has enough replicas for every shard in a collection, there is no single point of failure. Updates will be sent to shard leaders by default.- Parameters:
builder
- aCloudSolrClient.Builder
with the options used to create the client.
-
-
Method Detail
-
setSoTimeout
@Deprecated public void setSoTimeout(int timeout)
Deprecated.since 7.0 UseCloudSolrClient.Builder
methods instead.
-
createRoutes
protected Map<String,LBHttpSolrClient.Req> createRoutes(UpdateRequest updateRequest, ModifiableSolrParams routableParams, DocCollection col, DocRouter router, Map<String,List<String>> urlMap, String idField)
- Overrides:
createRoutes
in classBaseCloudSolrClient
-
getRouteException
protected CloudSolrClient.RouteException getRouteException(SolrException.ErrorCode serverError, NamedList<Throwable> exceptions, Map<String,? extends LBSolrClient.Req> routes)
- Overrides:
getRouteException
in classBaseCloudSolrClient
-
setParallelUpdates
@Deprecated public void setParallelUpdates(boolean parallelUpdates)
Deprecated.since 7.2 UseCloudSolrClient.Builder
methods instead.
-
condenseResponse
@Deprecated public CloudSolrClient.RouteResponse condenseResponse(NamedList response, int timeMillis)
Deprecated.since Solr 8.0- Overrides:
condenseResponse
in classBaseCloudSolrClient
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classBaseCloudSolrClient
- Throws:
IOException
-
getLbClient
public LBHttpSolrClient getLbClient()
- Specified by:
getLbClient
in classBaseCloudSolrClient
-
getHttpClient
public org.apache.http.client.HttpClient getHttpClient()
-
setConnectionTimeout
@Deprecated public void setConnectionTimeout(int timeout)
Deprecated.since 7.0 UseCloudSolrClient.Builder
methods instead.
-
getClusterStateProvider
public ClusterStateProvider getClusterStateProvider()
- Specified by:
getClusterStateProvider
in classBaseCloudSolrClient
-
wasCommError
protected boolean wasCommError(Throwable rootCause)
- Specified by:
wasCommError
in classBaseCloudSolrClient
-
-