Class: LucidWorks::Server
- Inherits:
-
Object
- Object
- LucidWorks::Server
- Includes:
- Associations
- Defined in:
- lib/lucid_works/server.rb,
lib/lucid_works/server/crawlers_status.rb
Overview
The LucidWorks::Server class is the starting point for access to a LucidWorks Solr search server.
Defined Under Namespace
Classes: CrawlersStatus
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#password ⇒ Object
Returns the value of attribute password.
-
#path ⇒ Object
Returns the value of attribute path.
-
#port ⇒ Object
Returns the value of attribute port.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
-
#server_uri ⇒ Object
Returns the value of attribute server_uri.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #api_uri ⇒ Object (also: #uri)
- #cluster ⇒ Object
- #clustered? ⇒ Boolean
- #crawler(name) ⇒ Object
- #datasource_type(type_name, crawler_name) ⇒ Object
- #datasource_types ⇒ Object
-
#initialize(server_uri) ⇒ Server
constructor
A new instance of Server.
-
#logs_uri ⇒ Object
Location where raw log files may be retrieved.
- #solr_uri ⇒ Object
Constructor Details
#initialize(server_uri) ⇒ Server
Returns a new instance of Server.
15 16 17 18 19 |
# File 'lib/lucid_works/server.rb', line 15 def initialize(server_uri) @server_uri = server_uri uri = URI.parse(@server_uri) @protocol, @host, @port, @user, @password = "#{uri.scheme}://", uri.host, uri.port, uri.user, uri.password end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
13 14 15 |
# File 'lib/lucid_works/server.rb', line 13 def host @host end |
#password ⇒ Object
Returns the value of attribute password.
13 14 15 |
# File 'lib/lucid_works/server.rb', line 13 def password @password end |
#path ⇒ Object
Returns the value of attribute path.
13 14 15 |
# File 'lib/lucid_works/server.rb', line 13 def path @path end |
#port ⇒ Object
Returns the value of attribute port.
13 14 15 |
# File 'lib/lucid_works/server.rb', line 13 def port @port end |
#protocol ⇒ Object
Returns the value of attribute protocol.
13 14 15 |
# File 'lib/lucid_works/server.rb', line 13 def protocol @protocol end |
#server_uri ⇒ Object
Returns the value of attribute server_uri.
13 14 15 |
# File 'lib/lucid_works/server.rb', line 13 def server_uri @server_uri end |
#user ⇒ Object
Returns the value of attribute user.
13 14 15 |
# File 'lib/lucid_works/server.rb', line 13 def user @user end |
Instance Method Details
#api_uri ⇒ Object Also known as: uri
21 22 23 |
# File 'lib/lucid_works/server.rb', line 21 def api_uri "#{server_uri}/api" end |
#cluster ⇒ Object
52 53 54 |
# File 'lib/lucid_works/server.rb', line 52 def cluster Cluster.new(solr_uri) end |
#clustered? ⇒ Boolean
43 44 45 46 47 48 49 50 |
# File 'lib/lucid_works/server.rb', line 43 def clustered? begin RestClient.get(solr_uri + "/zookeeper") true rescue RestClient::ResourceNotFound false end end |
#crawler(name) ⇒ Object
35 36 37 |
# File 'lib/lucid_works/server.rb', line 35 def crawler(name) crawlers.detect {|c| c.name == name } end |
#datasource_type(type_name, crawler_name) ⇒ Object
39 40 41 |
# File 'lib/lucid_works/server.rb', line 39 def datasource_type(type_name, crawler_name) crawler(crawler_name).datasource_type(type_name) end |
#datasource_types ⇒ Object
56 57 58 |
# File 'lib/lucid_works/server.rb', line 56 def datasource_types crawlers.collect(&:datasource_types).flatten end |
#logs_uri ⇒ Object
Location where raw log files may be retrieved
31 32 33 |
# File 'lib/lucid_works/server.rb', line 31 def logs_uri "#{server_uri}/logs" end |
#solr_uri ⇒ Object
26 27 28 |
# File 'lib/lucid_works/server.rb', line 26 def solr_uri "#{server_uri}/solr" end |