To index your data, you can run the following rake task:
There is also abbreviated versions, to save your fingers the few extra keystrokes:
The output of this task will look roughly like this:
This task, run normally, will also generate the configuration file for
Sphinx. If you decide to make custom changes, then you can disable this
If you’re using a version of Thinking Sphinx older than 1.3.10, then
reindex doesn’t exist, but you can do the same thing by setting the
INDEX_ONLY environment variable 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:
Rebuilding Sphinx Indexes
When you make changes to your Sphinx index structure, you will need to stop and start Sphinx for these changes to take effect, as well as re-index the data. This is all wrapped up into a single task:
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.
Checking your version of Thinking Sphinx
There is also a rake task for outputting the version of Thinking Sphinx you’re using.