Class: Solr::DataImport::Request

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

Constant Summary collapse

PATH =
'/dataimport'.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Request

Returns a new instance of Request.



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

def initialize(params)
  @params = params
end

Instance Attribute Details

#paramsObject (readonly)

Returns the value of attribute params.



6
7
8
# File 'lib/solr/data_import/request.rb', line 6

def params
  @params
end

Instance Method Details

#run(runner_options: nil) ⇒ Object

We want to make sure we send every dataimport request to the same node because this same class could be used to start a dataimport and to get dataimport progress data afterwards. To make it consistent we will send dataimport requests only to the first shard leader replica



15
16
17
18
19
# File 'lib/solr/data_import/request.rb', line 15

def run(runner_options: nil)
  http_request = Solr::Request::HttpRequest.new(path: PATH, url_params: params, method: :get)
  options = default_runner_options.merge(runner_options || {})
  Solr::Request::Runner.call(request: http_request, **options)
end