class Solr4R::Client
Constants
- DEFAULT_ANALYZE_DOCUMENT_PATH
- DEFAULT_ANALYZE_FIELD_PATH
- DEFAULT_BATCH_SIZE
- DEFAULT_CORE
- DEFAULT_CORES_PATH
- DEFAULT_FIELDS_PATH
- DEFAULT_HOST
- DEFAULT_MLT_PATH
- DEFAULT_PARAMS
- DEFAULT_PATH
- DEFAULT_PING_PATH
- DEFAULT_PORT
- DEFAULT_SELECT_PATH
- DEFAULT_SPELL_PATH
- DEFAULT_SYSTEM_PATH
- DEFAULT_UPDATE_PATH
- DEFAULT_UPDATE_TYPE
- DEFAULT_URI
- MATCH_ALL_QUERY
- MLT_DEFAULT_FL
- MLT_DEFAULT_ROWS
- MLT_LOCAL_PARAMS
Attributes
builder[RW]
default_params[RW]
endpoints[RW]
ep[RW]
options[RW]
request[RW]
Public Class Methods
default_uri(options = {})
click to toggle source
# File lib/solr4r/client.rb, line 50 def default_uri(options = {}) DEFAULT_URI % [ options.fetch(:host, DEFAULT_HOST), options.fetch(:port, DEFAULT_PORT), options.fetch(:path, DEFAULT_PATH), options.fetch(:collection) { options.fetch(:core, DEFAULT_CORE) } ] end
new(options = {})
click to toggle source
# File lib/solr4r/client.rb, line 62 def initialize(options = {}) uri, options = options, {} unless options.is_a?(Hash) self.options, self.default_params = options, options.fetch(:default_params, DEFAULT_PARAMS) self.logger = options.fetch(:logger) { default_logger } self.builder = options.fetch(:builder) { forward_logger( Builder.new(self)) } self.request = options.fetch(:request) { forward_logger( Request.new(self, uri || options.fetch(:uri) { default_uri })) } self.endpoints = forward_logger( Endpoints.new(self)) end
Public Instance Methods
get(path, params = {}, options = {}, &block)
click to toggle source
# File lib/solr4r/client.rb, line 94 def get(path, params = {}, options = {}, &block) send_request(path, options.merge( method: :get, params: params), &block) end
head(path, params = {}, options = {}, &block)
click to toggle source
# File lib/solr4r/client.rb, line 108 def head(path, params = {}, options = {}, &block) send_request(path, options.merge( method: :head, params: params), &block) end
inspect()
click to toggle source
# File lib/solr4r/client.rb, line 115 def inspect '#<%s:0x%x @default_params=%p %s>' % [ self.class, object_id, default_params, request_line ] end
json(path, params = {}, options = {}, &block)
click to toggle source
# File lib/solr4r/client.rb, line 88 def json(path, params = {}, options = {}, &block) get(path, params.merge(wt: :json), options, &block).result end
post(path, data = nil, params = {}, options = {}, &block)
click to toggle source
# File lib/solr4r/client.rb, line 101 def post(path, data = nil, params = {}, options = {}, &block) send_request(path, options.merge( method: :post, params: params, data: data), &block) end
Private Instance Methods
amend_options_hash(options, key, value)
click to toggle source
# File lib/solr4r/client.rb, line 132 def amend_options_hash(options, key, value) options.merge(key => value.merge(options.fetch(key, {}))) end
default_uri()
click to toggle source
# File lib/solr4r/client.rb, line 123 def default_uri self.class.default_uri(options) end
send_request(path, options, &block)
click to toggle source
# File lib/solr4r/client.rb, line 127 def send_request(path, options, &block) execute(path, amend_options_hash( options, :params, default_params), &block) end