Module: SimpleSolrClient::Core::Admin

Included in:
SimpleSolrClient::Core
Defined in:
lib/simple_solr_client/core/admin.rb

Instance Method Summary collapse

Instance Method Details

#commitObject

Send a commit command

Returns:

  • self



18
19
20
21
# File 'lib/simple_solr_client/core/admin.rb', line 18

def commit
  update({'commit' => {}})
  self
end

#optimizeObject

Send an optimize command

Returns:

  • self



25
26
27
28
# File 'lib/simple_solr_client/core/admin.rb', line 25

def optimize
  update({"optimize" => {}})
  self
end

#pingObject



2
3
4
# File 'lib/simple_solr_client/core/admin.rb', line 2

def ping
  get('admin/ping')
end

#reloadObject

Reload the core (for when you’ve changed the schema, solrconfig, synonyms, etc.) Make sure to mark the schema as dirty!

Returns:

  • self



33
34
35
36
37
# File 'lib/simple_solr_client/core/admin.rb', line 33

def reload
  get('admin/cores', {:force_top_level_url => true, :core => core, :action => 'RELOAD'})
  @schema = nil
  self
end

#unloadObject

Unload the current core and delete all its files

Returns:

  • The Solr response



41
42
43
# File 'lib/simple_solr_client/core/admin.rb', line 41

def unload
  get('admin/cores', {:force_top_level_url => true, :core => core, :action => 'UNLOAD', :deleteInstanceDir => true})
end

#up?Boolean

Is the server up (and responding to a ping?)

Returns:

  • (Boolean)


8
9
10
11
12
13
14
# File 'lib/simple_solr_client/core/admin.rb', line 8

def up?
  begin
    ping.status == 'OK'
  rescue
    false
  end
end