Class: Sunspot::Rails::Configuration
- Inherits:
-
Object
- Object
- Sunspot::Rails::Configuration
- Defined in:
- lib/sunspot/rails/configuration.rb
Overview
Sunspot::Rails is configured via the config/sunspot.yml file, which contains properties keyed by environment name. A sample sunspot.yml file would look like:
development:
solr:
hostname: localhost
port: 8982
test:
solr:
hostname: localhost
port: 8983
production:
solr:
hostname: localhost
port: 8983
path: /solr/myindex
Sunspot::Rails uses the configuration to set up the Solr connection, as well as for starting Solr with the appropriate port using the rake sunspot:solr:start task.
Instance Method Summary collapse
-
#hostname ⇒ Object
The host name at which to connect to Solr.
-
#path ⇒ Object
The path to the Solr servlet (useful if you are running multicore).
-
#port ⇒ Object
The port at which to connect to Solr.
Instance Method Details
#hostname ⇒ Object
The host name at which to connect to Solr. Default ‘localhost’.
Returns
- String
-
host name
35 36 37 38 39 40 |
# File 'lib/sunspot/rails/configuration.rb', line 35 def hostname @hostname ||= if user_configuration.has_key?('solr') user_configuration['solr']['hostname'] end || 'localhost' end |
#path ⇒ Object
The path to the Solr servlet (useful if you are running multicore). Default ‘/solr’.
Returns
- String
-
path
64 65 66 67 68 69 |
# File 'lib/sunspot/rails/configuration.rb', line 64 def path @path ||= if user_configuration.has_key?('solr') "#{user_configuration['solr']['path'] || '/solr'}" end end |
#port ⇒ Object
The port at which to connect to Solr. Default 8983.
Returns
- Integer
-
port
49 50 51 52 53 54 |
# File 'lib/sunspot/rails/configuration.rb', line 49 def port @port ||= if user_configuration.has_key?('solr') user_configuration['solr']['port'] end || 8983 end |