Class: Rays::Server::SolrServer
- Inherits:
-
BaseServer
- Object
- BaseServer
- Rays::Server::SolrServer
- Defined in:
- lib/rays/servers/solr.rb
Instance Attribute Summary collapse
-
#solr_instance ⇒ Object
readonly
Returns the value of attribute solr_instance.
Attributes inherited from BaseServer
Instance Method Summary collapse
- #alive? ⇒ Boolean
- #clean_all ⇒ Object
-
#initialize(name, host, remote, java_home, java_bin, port, url, application_service) ⇒ SolrServer
constructor
A new instance of SolrServer.
- #port ⇒ Object
- #service ⇒ Object
- #url ⇒ Object
Methods inherited from BaseServer
#host, #java_cmd, #java_home, #remote, #remote?
Constructor Details
#initialize(name, host, remote, java_home, java_bin, port, url, application_service) ⇒ SolrServer
Returns a new instance of SolrServer.
30 31 32 33 34 35 36 |
# File 'lib/rays/servers/solr.rb', line 30 def initialize(name, host, remote, java_home, java_bin, port, url, application_service) super(name, host, remote, java_home, java_bin) @port = port @url = url @solr_instance = RSolr.connect(:url => solr_url) @service = application_service end |
Instance Attribute Details
#solr_instance ⇒ Object (readonly)
Returns the value of attribute solr_instance.
28 29 30 |
# File 'lib/rays/servers/solr.rb', line 28 def solr_instance @solr_instance end |
Instance Method Details
#alive? ⇒ Boolean
53 54 55 56 57 58 59 60 |
# File 'lib/rays/servers/solr.rb', line 53 def alive? begin @solr_instance.get('select', :params => { :q => '*:*', :limit => 1}) return true rescue return false end end |
#clean_all ⇒ Object
62 63 64 65 66 |
# File 'lib/rays/servers/solr.rb', line 62 def clean_all solr_transaction do @solr_instance.delete_by_query('*:*') end end |
#port ⇒ Object
38 39 40 41 |
# File 'lib/rays/servers/solr.rb', line 38 def port raise RaysException.new(missing_environment_option('SOLR server', 'port')) if @port.nil? @port end |
#service ⇒ Object
48 49 50 51 |
# File 'lib/rays/servers/solr.rb', line 48 def service raise RaysException.new(missing_environment_option('SOLR service', 'service')) if @service.nil? @service end |
#url ⇒ Object
43 44 45 46 |
# File 'lib/rays/servers/solr.rb', line 43 def url raise RaysException.new(missing_environment_option('SOLR server', 'instance')) if @url.nil? @url end |