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 theLBHttpSolrClientto 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 classCloudSolrClient.BuilderConstructsCloudSolrClientinstances from provided configuration.static classCloudSolrClient.RouteExceptionDeprecated.since Solr 8.0static classCloudSolrClient.RouteResponseDeprecated.since Solr 8.0
-
Field Summary
Fields Modifier and Type Field Description static StringSTATE_VERSION-
Fields inherited from class org.apache.solr.client.solrj.impl.BaseCloudSolrClient
collectionStateCache
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedCloudSolrClient(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.Builderwith the options used to create the client.
-
-
Method Detail
-
setSoTimeout
@Deprecated public void setSoTimeout(int timeout)
Deprecated.since 7.0 UseCloudSolrClient.Buildermethods instead.
-
createRoutes
protected Map<String,LBHttpSolrClient.Req> createRoutes(UpdateRequest updateRequest, ModifiableSolrParams routableParams, DocCollection col, DocRouter router, Map<String,List<String>> urlMap, String idField)
- Overrides:
createRoutesin classBaseCloudSolrClient
-
getRouteException
protected CloudSolrClient.RouteException getRouteException(SolrException.ErrorCode serverError, NamedList<Throwable> exceptions, Map<String,? extends LBSolrClient.Req> routes)
- Overrides:
getRouteExceptionin classBaseCloudSolrClient
-
setParallelUpdates
@Deprecated public void setParallelUpdates(boolean parallelUpdates)
Deprecated.since 7.2 UseCloudSolrClient.Buildermethods instead.
-
condenseResponse
@Deprecated public CloudSolrClient.RouteResponse condenseResponse(NamedList response, int timeMillis)
Deprecated.since Solr 8.0- Overrides:
condenseResponsein classBaseCloudSolrClient
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classBaseCloudSolrClient- Throws:
IOException
-
getLbClient
public LBHttpSolrClient getLbClient()
- Specified by:
getLbClientin classBaseCloudSolrClient
-
getHttpClient
public org.apache.http.client.HttpClient getHttpClient()
-
setConnectionTimeout
@Deprecated public void setConnectionTimeout(int timeout)
Deprecated.since 7.0 UseCloudSolrClient.Buildermethods instead.
-
getClusterStateProvider
public ClusterStateProvider getClusterStateProvider()
- Specified by:
getClusterStateProviderin classBaseCloudSolrClient
-
wasCommError
protected boolean wasCommError(Throwable rootCause)
- Specified by:
wasCommErrorin classBaseCloudSolrClient
-
-