Class: Solr
- Inherits:
-
Object
- Object
- Solr
- Defined in:
- lib/openteam/capistrano/solr/solr.rb
Defined Under Namespace
Classes: Replicator
Instance Attribute Summary collapse
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #index_version ⇒ Object
-
#initialize(url) ⇒ Solr
constructor
A new instance of Solr.
- #send_clear_command(core) ⇒ Object
- #send_reload_core_command(core) ⇒ Object
- #send_replication_command(command, extra = {}) ⇒ Object
- #send_version_command ⇒ Object
Constructor Details
#initialize(url) ⇒ Solr
Returns a new instance of Solr.
43 44 45 |
# File 'lib/openteam/capistrano/solr/solr.rb', line 43 def initialize(url) self.url = url end |
Instance Attribute Details
#url ⇒ Object
Returns the value of attribute url.
41 42 43 |
# File 'lib/openteam/capistrano/solr/solr.rb', line 41 def url @url end |
Instance Method Details
#index_version ⇒ Object
47 48 49 |
# File 'lib/openteam/capistrano/solr/solr.rb', line 47 def index_version send_version_command['indexversion'].to_i end |
#send_clear_command(core) ⇒ Object
65 66 67 68 |
# File 'lib/openteam/capistrano/solr/solr.rb', line 65 def send_clear_command(core) send_command 'update', params: { :commit => true, 'stream.body' => '<delete><query>*:*</query></delete>' } puts "The '#{core}' core has been successfully cleared" end |
#send_reload_core_command(core) ⇒ Object
60 61 62 63 |
# File 'lib/openteam/capistrano/solr/solr.rb', line 60 def send_reload_core_command(core) send_command '/cores/admin/cores', params: { action: 'RELOAD', core: core } puts "The '#{core}' core has been successfully reloaded" end |
#send_replication_command(command, extra = {}) ⇒ Object
55 56 57 58 |
# File 'lib/openteam/capistrano/solr/solr.rb', line 55 def send_replication_command(command, extra = {}) send_command 'replication', params: { command: command }.merge(extra) puts 'Index has been successfully received' end |
#send_version_command ⇒ Object
51 52 53 |
# File 'lib/openteam/capistrano/solr/solr.rb', line 51 def send_version_command send_command 'replication', params: { command: :indexversion } end |