Class: Solr::Query::Handler

Inherits:
Object
  • Object
show all
Defined in:
lib/solr/query/handler.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(query:, rows:, start:, runner_options: {}) ⇒ Handler

Returns a new instance of Handler.



14
15
16
17
18
19
# File 'lib/solr/query/handler.rb', line 14

def initialize(query:, rows:, start:, runner_options: {})
  @query = query
  @rows = rows
  @start = start
  @runner_options = runner_options || {}
end

Instance Attribute Details

#queryObject (readonly)

Returns the value of attribute query.



8
9
10
# File 'lib/solr/query/handler.rb', line 8

def query
  @query
end

#rowsObject (readonly)

Returns the value of attribute rows.



8
9
10
# File 'lib/solr/query/handler.rb', line 8

def rows
  @rows
end

#runner_optionsObject (readonly)

Returns the value of attribute runner_options.



8
9
10
# File 'lib/solr/query/handler.rb', line 8

def runner_options
  @runner_options
end

#startObject (readonly)

Returns the value of attribute start.



8
9
10
# File 'lib/solr/query/handler.rb', line 8

def start
  @start
end

Class Method Details

.call(opts) ⇒ Object



10
11
12
# File 'lib/solr/query/handler.rb', line 10

def self.call(opts)
  new(**opts).call
end

Instance Method Details

#callObject



21
22
23
24
25
# File 'lib/solr/query/handler.rb', line 21

def call
  http_request = Solr::Query::HttpRequestBuilder.call(query: query, start: start, rows: rows)
  solr_response = Solr::Request::Runner.call(request: http_request, **runner_options)
  Solr::Query::Response::Parser.new(request: query, solr_response: solr_response.body).to_response
end