Class: SimpleSolrClient::Core

Inherits:
Client
  • Object
show all
Includes:
Admin, CoreData, Index, Search
Defined in:
lib/simple_solr_client/core.rb,
lib/simple_solr_client/core.rb

Defined Under Namespace

Modules: Admin, CoreData, Index, Search

Instance Attribute Summary collapse

Attributes included from CoreData

#raw_solr_hash

Attributes inherited from Client

#base_url, #rawclient

Instance Method Summary collapse

Methods included from Search

#all, #fv_search, #id

Methods included from Index

#add_docs, #clear, #delete

Methods included from CoreData

#config_file, #core_data_hash, #data_dir, #index, #instance_dir, #last_modified, #number_of_documents, #size

Methods included from Admin

#commit, #optimize, #reload, #unload

Methods inherited from Client

#_get, #_post_json, #cores, #get, #major_version, #new_core, #ping, #post_json, #raw_get_content, #system, #temp_core, #temp_core_dir_setup, #top_level_url, #unload_temp_cores, #up?, #version

Constructor Details

#initialize(url, core = nil) ⇒ Core

Returns a new instance of Core.



26
27
28
29
30
31
32
33
34
# File 'lib/simple_solr_client/core.rb', line 26

def initialize(url, core=nil)
  if core.nil?
    components = url.gsub(%r[/\Z], '').split('/')
    core = components.last
    url = components[0..-2].join('/')
  end
  super(url)
  @core = core
end

Instance Attribute Details

#coreObject (readonly) Also known as: name

Returns the value of attribute core.



23
24
25
# File 'lib/simple_solr_client/core.rb', line 23

def core
  @core
end

Instance Method Details

#update(object_to_post, response_type = nil) ⇒ Object

Send JSON to this core’s update/json handler



43
44
45
# File 'lib/simple_solr_client/core.rb', line 43

def update(object_to_post, response_type = nil)
  post_json('update/json', object_to_post, response_type)
end

#url(*args) ⇒ Object

Override #url so we’re now talking to the core



38
39
40
# File 'lib/simple_solr_client/core.rb', line 38

def url(*args)
  [@base_url, @core, *args].join('/').chomp('/')
end