Class: Sunspot::Rails::Server
- Inherits:
-
Server
- Object
- Server
- Sunspot::Rails::Server
- 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
-
#bootstrap ⇒ Object
Bootstrap a new solr_home by creating all required directories.
-
#lib_path ⇒ Object
Directory to store custom libraries for solr.
-
#log_file ⇒ Object
Log file for Solr.
-
#log_level ⇒ Object
Severity level for logging.
-
#max_memory ⇒ Object
Maximum Java heap size for Solr.
-
#min_memory ⇒ Object
Minimum Java heap size for Solr.
-
#pid_dir ⇒ Object
Directory in which to store PID files.
-
#pid_file ⇒ Object
Name of the PID file.
-
#port ⇒ Object
Port on which to run Solr.
- #run ⇒ Object
-
#solr_data_dir ⇒ Object
Directory to store lucene index data files.
-
#solr_home ⇒ Object
Directory to use for Solr home.
-
#solr_jar ⇒ Object
Solr start jar.
- #start ⇒ Object
Instance Method Details
#bootstrap ⇒ Object
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_path ⇒ Object
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_file ⇒ Object
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_level ⇒ Object
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_memory ⇒ Object
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_memory ⇒ Object
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_dir ⇒ Object
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_file ⇒ Object
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 |
#port ⇒ Object
Port on which to run Solr
82 83 84 |
# File 'lib/sunspot/rails/server.rb', line 82 def port configuration.port end |
#run ⇒ Object
13 14 15 16 |
# File 'lib/sunspot/rails/server.rb', line 13 def run bootstrap super end |
#solr_data_dir ⇒ Object
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_home ⇒ Object
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_jar ⇒ Object
Solr start jar
75 76 77 |
# File 'lib/sunspot/rails/server.rb', line 75 def solr_jar configuration.solr_jar || super end |
#start ⇒ Object
8 9 10 11 |
# File 'lib/sunspot/rails/server.rb', line 8 def start bootstrap super end |