class Solr::Request::Cloud::FirstShardLeaderNodeSelectionStrategy

Public Instance Methods

call() click to toggle source
# File lib/solr/request/cloud/first_shard_leader_node_selection_strategy.rb, line 5
def call
  leader = first_shard_leader_replica_node_for(collection: collection_name)
  replicas = solr_cloud_active_nodes_urls.shuffle
  urls = ([leader] + replicas).flatten.uniq
  map_urls_to_collections(urls)
end

Private Instance Methods

first_shard_leader_replica_node_for(collection:) click to toggle source
# File lib/solr/request/cloud/first_shard_leader_node_selection_strategy.rb, line 14
def first_shard_leader_replica_node_for(collection:)
  shards = Solr.shards_for(collection: collection)
  return unless shards
  first_shard_name = shards.sort.first
  Solr.leader_replica_node_for(collection: collection, shard: first_shard_name)
end
solr_cloud_active_nodes_urls() click to toggle source
# File lib/solr/request/cloud/first_shard_leader_node_selection_strategy.rb, line 21
def solr_cloud_active_nodes_urls
  Solr.active_nodes_for(collection: collection_name)
end