Class BaseCloudSolrClient

    • Field Detail

      • collectionStateCache

        protected final org.apache.solr.client.solrj.impl.BaseCloudSolrClient.StateCache collectionStateCache
    • Constructor Detail

      • BaseCloudSolrClient

        protected BaseCloudSolrClient​(boolean updatesToLeaders,
                                      boolean parallelUpdates,
                                      boolean directUpdatesToLeadersOnly)
    • Method Detail

      • setRetryExpiryTime

        public void setRetryExpiryTime​(int secs)
        This is the time to wait to refetch the state after getting the same state version from ZK

        secs

      • setCollectionCacheTTl

        public void setCollectionCacheTTl​(int seconds)
        Sets the cache ttl for DocCollection Objects cached . This is only applicable for collections which are persisted outside of clusterstate.json
        Parameters:
        seconds - ttl value in seconds
      • getLbClient

        protected abstract LBSolrClient getLbClient()
      • wasCommError

        protected abstract boolean wasCommError​(Throwable t)
      • setParser

        public void setParser​(ResponseParser processor)
        Note: This setter method is not thread-safe.
        Parameters:
        processor - Default Response Parser chosen to parse the response if the parser were not specified as part of the request.
        See Also:
        SolrRequest.getResponseParser()
      • setRequestWriter

        public void setRequestWriter​(RequestWriter requestWriter)
      • getZkHost

        public String getZkHost()
        Returns:
        the zkHost value used to connect to zookeeper.
      • setIdField

        public void setIdField​(String idField)
        Parameters:
        idField - the field to route documents on.
      • getIdField

        public String getIdField()
        Returns:
        the field that updates are routed on.
      • setDefaultCollection

        public void setDefaultCollection​(String collection)
        Sets the default collection for request
      • getDefaultCollection

        public String getDefaultCollection()
        Gets the default collection for request
      • setZkConnectTimeout

        public void setZkConnectTimeout​(int zkConnectTimeout)
        Set the connect timeout to the zookeeper ensemble in ms
      • setZkClientTimeout

        public void setZkClientTimeout​(int zkClientTimeout)
        Set the timeout to the zookeeper ensemble in ms
      • isParallelUpdates

        public boolean isParallelUpdates()
        Gets whether direct updates are sent in parallel
      • connect

        public void connect()
        Connect to the zookeeper ensemble. This is an optional method that may be used to force a connect before any other requests are sent.
      • connect

        public void connect​(long duration,
                            TimeUnit timeUnit)
                     throws TimeoutException,
                            InterruptedException
        Connect to a cluster. If the cluster is not ready, retry connection up to a given timeout.
        Parameters:
        duration - the timeout
        timeUnit - the units of the timeout
        Throws:
        TimeoutException - if the cluster is not ready after the timeout
        InterruptedException - if the wait is interrupted
      • registerCollectionStateWatcher

        public void registerCollectionStateWatcher​(String collection,
                                                   CollectionStateWatcher watcher)
        Register a CollectionStateWatcher to be called when the cluster state for a collection changes Note that the watcher is unregistered after it has been called once. To make a watcher persistent, it should re-register itself in its CollectionStateWatcher.onStateChanged(Set, DocCollection) call
        Parameters:
        collection - the collection to watch
        watcher - a watcher that will be called when the state changes
      • isUpdatesToLeaders

        public boolean isUpdatesToLeaders()
      • isDirectUpdatesToLeadersOnly

        public boolean isDirectUpdatesToLeadersOnly()
        Returns:
        true if direct updates are sent to shard leaders only
      • setParallelCacheRefreshes

        public void setParallelCacheRefreshes​(int n)
        If caches are expired they are refreshed after acquiring a lock. use this to set the number of locks
      • getMinAchievedReplicationFactor

        public int getMinAchievedReplicationFactor​(String collection,
                                                   NamedList resp)
        Useful for determining the minimum achieved replication factor across all shards involved in processing an update request, typically useful for gauging the replication factor of a batch.
      • getShardReplicationFactor

        public Map<String,​Integer> getShardReplicationFactor​(String collection,
                                                                   NamedList resp)
        Walks the NamedList response after performing an update request looking for the replication factor that was achieved in each shard involved in the request. For single doc updates, there will be only one shard in the return value.