Once you’ve got an index set up on your model, and have the Sphinx daemon running, then you can start to search, using a model named just that. pancakes  

To focus a query on a specific field, you can use the :conditions option - much like in ActiveRecord: :conditions => {:subject => pancakes}  

You can combine both field-specific queries and generic queries too: pancakes, :conditions => {:subject => tasty}  

Please keep in mind that Sphinx does not support SQL comparison operators - it has its own query language. The :conditions option must be a hash, with each key a field and each value a string.

Filters on attributes can be defined using a similar syntax, but using the :with option. pancakes, :with => {:author\_id =>}  

Filters have the advantage over focusing on specific fields in that they accept arrays and ranges: pancakes, :with => {  
 :created\_at =>,  
 :author\_id => @fab\_four.collect { |author| }  

And of course, you can mix and match global terms, field-specific terms, and filters: pancakes,  
 :conditions => {:subject => tasty},  
 :with => {:created\_at =>}  


Sphinx paginates search results by default. Indeed, there’s no way to turn it off (but you can request really big pages should you wish). The parameters for pagination in Thinking Sphinx are exactly the same as Will Paginate: :page and :per_page. pancakes, :page => params\[:page\], :per\_page =>

The output of search results can be used with Will Paginate’s view helper as well, just to keep things nice and easy.

1.  in the controller:  
    @articles = pancakes

<!-- -->

1.  in the view:  
    will\_paginate @articles