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.

Methods

Classes and Modules

Class Sphincter::Configure::Index

Constants

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.

Public Class methods

Builds and writes out a sphinx.conf file.

Merges Hashes of Hashes mergee and hash.

Builds the Sphincter configuration.

Automatically fills in searchd address, port and pid_file from ‘sphincter’ section.

Reads configuration file file. Returns {} if the file does not exist.

Retrieves the database configuration for ActiveRecord::Base and adapts it for a sphinx.conf file.

Builds a sphinx.conf source configuration for each index.

Iterates over the searchable ActiveRecord::Base classes and assigns an index to each one. Returns the total number of indexes found.

Loads ActiveRecord::Base models from app/models.

Returns the pid of searchd if searchd is running, otherwise false.

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.

The path to sphinx.conf.

The directory where sphinx‘s files live.

Writes out a sphinx.conf configuration using conf and sources.

[Validate]