Class: DataMapper::SphinxConfig
- Inherits:
-
Object
- Object
- DataMapper::SphinxConfig
- Defined in:
- lib/dm-sphinx-adapter/sphinx_config.rb
Instance Method Summary collapse
-
#address ⇒ Object
Searchd address.
-
#config ⇒ String
Configuration file full path name.
-
#indexer_bin(use_config = true) ⇒ Object
Indexer binary full path name and config argument.
-
#initialize(uri_or_options = {}) ⇒ SphinxConfig
constructor
Read a sphinx configuration file.
-
#log ⇒ Object
Searchd log file.
-
#pid_file ⇒ Object
Searchd pid_file.
-
#port ⇒ Object
Searchd port.
-
#searchd ⇒ Object
Searchd configuration options.
-
#searchd_bin(use_config = true) ⇒ Object
Searchd binardy full path name and config argument.
Constructor Details
#initialize(uri_or_options = {}) ⇒ SphinxConfig
Read a sphinx configuration file.
This class just gives you access to handy searchd {} configuration options. It does not validate your configuration file beyond basic syntax checking.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/dm-sphinx-adapter/sphinx_config.rb', line 15 def initialize( = {}) @config = [] @searchd = { 'address' => '0.0.0.0', 'log' => 'searchd.log', 'max_children' => 0, 'max_matches' => 1000, 'pid_file' => nil, 'port' => 3312, 'preopen_indexes' => 0, 'query_log' => '', 'read_timeout' => 5, 'seamless_rotate' => 1, 'unlink_old' => 1 } path = case when Addressable::URI, DataObjects::URI then .path when Hash then [:config] || [:database] when Pathname then when String then DataObjects::URI.parse().path end parse('' + path.to_s) # Force stringy since Pathname#to_s is broken IMO. end |
Instance Method Details
#address ⇒ Object
Searchd address.
66 67 68 |
# File 'lib/dm-sphinx-adapter/sphinx_config.rb', line 66 def address searchd['address'] end |
#config ⇒ String
Configuration file full path name.
44 45 46 |
# File 'lib/dm-sphinx-adapter/sphinx_config.rb', line 44 def config @config end |
#indexer_bin(use_config = true) ⇒ Object
Indexer binary full path name and config argument.
50 51 52 53 54 |
# File 'lib/dm-sphinx-adapter/sphinx_config.rb', line 50 def indexer_bin(use_config = true) path = 'indexer' # TODO: Real. path << " --config #{config}" if config path end |
#log ⇒ Object
Searchd log file.
84 85 86 |
# File 'lib/dm-sphinx-adapter/sphinx_config.rb', line 84 def log searchd['log'] end |
#pid_file ⇒ Object
Searchd pid_file.
78 79 80 |
# File 'lib/dm-sphinx-adapter/sphinx_config.rb', line 78 def pid_file searchd['pid_file'] or raise "Mandatory pid_file option missing from searchd configuration." end |
#port ⇒ Object
Searchd port.
72 73 74 |
# File 'lib/dm-sphinx-adapter/sphinx_config.rb', line 72 def port searchd['port'] end |
#searchd ⇒ Object
Searchd configuration options.
92 93 94 |
# File 'lib/dm-sphinx-adapter/sphinx_config.rb', line 92 def searchd @searchd end |
#searchd_bin(use_config = true) ⇒ Object
Searchd binardy full path name and config argument.
58 59 60 61 62 |
# File 'lib/dm-sphinx-adapter/sphinx_config.rb', line 58 def searchd_bin(use_config = true) path = 'searchd' # TODO: Real. path << " --config #{config}" if config path end |