| Module | Sphincter::Configure |
| In: |
lib/sphincter/configure.rb
|
Configuration module for Sphincter.
DEFAULT_CONF contains the default options. They can be overridden in both a global config/sphincter.yml and in a per-environment config/environments/sphincter.RAILS_ENV.yml.
The only option you should need to override is the port option of sphincter, so a config file for separate test and development indexes would look like:
config/environments/sphincter.development.yml:
sphincter:
port: 3313
config/environments/sphincter.test.yml:
sphincter:
port: 3314
Configuration options:
| sphincter: | Options for serachd‘s and Sphinx‘s port and address, and |
paths for index files.
| index: | Options for a sphinx index conf section |
| indexer: | Options for the sphinx indexer |
| mysql: | Options for the sphinx indexer‘s mysql database connection. The important ones are filled from config/database.yml |
| searchd: | Options for a sphinx searchd conf section |
| source: | Options for a sphinx source conf section |
The sphincter entry contains:
| address: | Which host searchd will run on, and which host Sphincter will connect to. |
| port: | Which port searchd and Sphincter will connect to. |
| path: | Location of searchd indexes, relative to RAILS_ROOT. |
| per_page: | How many items to include in a search by default. |
All other entries are from Sphinx.
See www.sphinxsearch.com/doc.html#reference for details on sphinx conf file settings.
| DEFAULT_CONF | = | { 'sphincter' => { 'address' => '127.0.0.1', 'path' => "sphinx/#{rails_env}", 'per_page' => 10, 'port' => 3312, }, 'index' => { 'charset_type' => 'utf-8', 'docinfo' => 'extern', 'min_word_len' => 1, 'morphology' => 'stem_en', 'stopwords' => '', }, 'indexer' => { 'mem_limit' => '32M', }, 'mysql' => { 'sql_query_pre' => [ 'SET NAMES utf8', ], }, 'searchd' => { 'log' => "log/sphinx/searchd.#{rails_env}.log", 'max_children' => 30, 'max_matches' => 1000, 'query_log' => "log/sphinx/query.#{rails_env}.log", 'read_timeout' => 5, }, 'source' => { 'index_html_attrs' => '', 'sql_query_post' => '', 'sql_range_step' => 20000, 'strip_html' => 0, }, } | Default Sphincter configuration. |
Iterates over the searchable ActiveRecord::Base classes and assigns an index to each one. Returns the total number of indexes found.
Outputs a sphinx.conf configuration section titled heading using the Hash data. Values in data may be a String or Array. For an Array, the Hash key is printed multiple times.