To index your data, you can run the following rake task:
There is also abbreviated versions, to save your fingers the few extra keystrokes:
This task, run normally, will also generate the configuration file for Sphinx. If you decide to make custom changes, then you can disable this generation by setting the environment variable INDEX_ONLY to true.
Generating the Configuration File
If you need to just generate the configuration file, without indexing (something that can be useful when deploying), here’s the task (and shortcuts) to do it:
Starting and Stopping Sphinx
If you actually want to search against the indexed data, then you’ll need Sphinx’s searchd daemon to be running. This can be controlled using the following tasks:
Handling Delta Indexes
If you’re using either the Delayed Job or Datetime/Timestamp delta approaches, you’ll need to run a task to manage the indexing. For the Delayed Job setup, the rake task runs constantly, processing any delta jobs (as well as any other normal jobs if you’re using the delayed_job plugin elsewhere in your application).
For those using Datetime Deltas, you’ll need to run the following task at a regular interval - whatever your threshold is set to.