Class: Sunspot::Rails::Server

Inherits:
Server
  • Object
show all
Defined in:
lib/sunspot/rails/server.rb

Constant Summary collapse

LOG_LEVELS =

ActiveSupport log levels are integers; this array maps them to the appropriate java.util.logging.Level constant

%w(FINE INFO WARNING SEVERE SEVERE INFO)

Instance Method Summary collapse

Instance Method Details

#bootstrapObject

Bootstrap a new solr_home by creating all required directories.

Returns

Boolean

success



26
27
28
29
30
31
# File 'lib/sunspot/rails/server.rb', line 26

def bootstrap
  unless @bootstrapped
    install_solr_home
    @bootstrapped = true
  end
end

#lib_pathObject

Directory to store custom libraries for solr



36
37
38
# File 'lib/sunspot/rails/server.rb', line 36

def lib_path
  File.join( solr_home, 'lib' )
end

#log_fileObject

Log file for Solr. File is in the rails log/ directory.



97
98
99
# File 'lib/sunspot/rails/server.rb', line 97

def log_file
  File.join(::Rails.root, 'log', "sunspot-solr-#{::Rails.env}.log")
end

#log_levelObject

Severity level for logging. This is based on the severity level for the Rails logger.



90
91
92
# File 'lib/sunspot/rails/server.rb', line 90

def log_level
  LOG_LEVELS[::Rails.logger.level]
end

#max_memoryObject

Maximum Java heap size for Solr



111
112
113
# File 'lib/sunspot/rails/server.rb', line 111

def max_memory
  configuration.max_memory
end

#min_memoryObject

Minimum Java heap size for Solr



104
105
106
# File 'lib/sunspot/rails/server.rb', line 104

def min_memory
  configuration.min_memory
end

#pid_dirObject

Directory in which to store PID files



43
44
45
# File 'lib/sunspot/rails/server.rb', line 43

def pid_dir
  File.join(::Rails.root, 'tmp', 'pids')
end

#pid_fileObject

Name of the PID file



50
51
52
# File 'lib/sunspot/rails/server.rb', line 50

def pid_file
  "sunspot-solr-#{::Rails.env}.pid"
end

#portObject

Port on which to run Solr



82
83
84
# File 'lib/sunspot/rails/server.rb', line 82

def port
  configuration.port
end

#runObject



13
14
15
16
# File 'lib/sunspot/rails/server.rb', line 13

def run
  bootstrap
  super
end

#solr_data_dirObject

Directory to store lucene index data files

Returns

String

data_path



61
62
63
# File 'lib/sunspot/rails/server.rb', line 61

def solr_data_dir
  File.join(solr_home, 'data', ::Rails.env)
end

#solr_homeObject

Directory to use for Solr home.



68
69
70
# File 'lib/sunspot/rails/server.rb', line 68

def solr_home
  File.join(configuration.solr_home)
end

#solr_jarObject

Solr start jar



75
76
77
# File 'lib/sunspot/rails/server.rb', line 75

def solr_jar
  configuration.solr_jar || super
end

#startObject



8
9
10
11
# File 'lib/sunspot/rails/server.rb', line 8

def start
  bootstrap
  super
end