Class: LucidWorks::Server

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#hostObject

Returns the value of attribute host.



13
14
15
# File 'lib/lucid_works/server.rb', line 13

def host
  @host
end

#passwordObject

Returns the value of attribute password.



13
14
15
# File 'lib/lucid_works/server.rb', line 13

def password
  @password
end

#pathObject

Returns the value of attribute path.



13
14
15
# File 'lib/lucid_works/server.rb', line 13

def path
  @path
end

#portObject

Returns the value of attribute port.



13
14
15
# File 'lib/lucid_works/server.rb', line 13

def port
  @port
end

#protocolObject

Returns the value of attribute protocol.



13
14
15
# File 'lib/lucid_works/server.rb', line 13

def protocol
  @protocol
end

#server_uriObject

Returns the value of attribute server_uri.



13
14
15
# File 'lib/lucid_works/server.rb', line 13

def server_uri
  @server_uri
end

#userObject

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_uriObject Also known as: uri



21
22
23
# File 'lib/lucid_works/server.rb', line 21

def api_uri
  "#{server_uri}/api"
end

#clusterObject



52
53
54
# File 'lib/lucid_works/server.rb', line 52

def cluster
  Cluster.new(solr_uri)
end

#clustered?Boolean

Returns:

  • (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_typesObject



56
57
58
# File 'lib/lucid_works/server.rb', line 56

def datasource_types
  crawlers.collect(&:datasource_types).flatten
end

#logs_uriObject

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_uriObject



26
27
28
# File 'lib/lucid_works/server.rb', line 26

def solr_uri
  "#{server_uri}/solr"
end