Class: Solr::Request::FirstShardLeaderNodeSelectionStrategy

Inherits:
Object
  • Object
show all
Defined in:
lib/solr/request/first_shard_leader_node_selection_strategy.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(collection_name) ⇒ FirstShardLeaderNodeSelectionStrategy

Returns a new instance of FirstShardLeaderNodeSelectionStrategy.



8
9
10
# File 'lib/solr/request/first_shard_leader_node_selection_strategy.rb', line 8

def initialize(collection_name)
  @collection_name = collection_name
end

Class Method Details

.call(collection_name) ⇒ Object



4
5
6
# File 'lib/solr/request/first_shard_leader_node_selection_strategy.rb', line 4

def self.call(collection_name)
  new(collection_name).call
end

Instance Method Details

#callObject



12
13
14
15
16
# File 'lib/solr/request/first_shard_leader_node_selection_strategy.rb', line 12

def call
  return [solr_url] unless Solr.cloud_enabled?

  ([first_shard_leader_replica_node_for(collection: @collection_name)] + solr_cloud_active_nodes_urls.shuffle).flatten.uniq
end