Class: SolrMakr::Commands::CreateCollection Private

Inherits:
ActiveInteraction::Base
  • Object
show all
Includes:
AbstractCommand
Defined in:
lib/solr_makr/commands/create_collection.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Constant Summary

Constants included from Utility

Utility::REQUIRED_SOLR_NODES

Instance Attribute Summary collapse

Attributes included from BufferInteraction

#buffer

Instance Method Summary collapse

Methods included from AbstractCommand

#expect_success!, #fetch_configset, #local_configuration

Methods included from Utility

default_table, default_table_options!, hash_to_table, looks_like_a_valid_configset?, path_to_configset

Methods included from BufferInteraction

#build_buffer, #compose_buffer

Instance Attribute Details

#remote_configset_nameString (readonly)

Returns:

  • (String)


42
43
44
# File 'lib/solr_makr/commands/create_collection.rb', line 42

attr_lazy_reader :remote_configset_name do
  config_name.presence || name
end

Instance Method Details

#executeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/solr_makr/commands/create_collection.rb', line 14

def execute
  configset_directory = fetch_configset(configset)

  unless remote_configset_exists?
    buffer.print ". Zookeeper configuration `#{config_name}` does not exist... creating"

    compose_buffer SolrMakr::Configsets::PushToZookeeper, name: remote_configset_name, directory: configset_directory
  end

  expect_success! solr_client.create(params_for_create)

  buffer.ok "Created collection: #{name}"
end

#params_for_createHash

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:

  • (Hash)


30
31
32
33
34
35
36
37
38
# File 'lib/solr_makr/commands/create_collection.rb', line 30

def params_for_create
  {
    name:                 name,
    config_name:          remote_configset_name,
    number_of_shards:     number_of_shards,
    replication_factor:   replication_factor,
    max_shards_per_node:  max_shards_per_node
  }
end