Rake Tasks


To index your data, you can run the following rake task:

rake thinking\_sphinx:index  

There is also abbreviated versions, to save your fingers the few extra keystrokes:

rake ts:index  
rake ts:in  

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.

rake thinking\_sphinx:index INDEX\_ONLY=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:

rake thinking\_sphinx:configure  
rake ts:conf  
rake ts:config  

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:

rake thinking\_sphinx:start  
rake ts:start  
rake thinking\_sphinx:stop  
rake ts:stop  

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).

rake thinking\_sphinx:delayed\_delta  
rake ts:dd  

For those using Datetime Deltas, you’ll need to run the following task at a regular interval - whatever your threshold is set to.

rake thinking\_sphinx:index:delta  
rake ts:in:delta