Class CloudSolrClient

    • Field Detail

      • collectionStateCache

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

      • CloudSolrClient

        protected CloudSolrClient​(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.
        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)
      • setDefaultCollection

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

        public String getDefaultCollection()
        Gets the default collection for request
      • 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
      • 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.