Firstly, you’ll want to install Sphinx and Riddle. You can use either Sphinx 0.9.8 or 0.9.9, but don’t forget which version you’re using. In your Ruby code, you’ll need to require the specific version of Riddle.
For example, using 0.9.8:
Or if you’re using using 0.9.9:
You’ll need an active Client instance:
Obviously, change the address and port to suit, if necessary.
Searching is done via the
The index name and comment are optional - the first will default to all
'*'), and the second to an empty string.
If you want to use different settings for your search request, you need
to set them up before you call the
query method. This includes adding
filters or setting match modes.
Documentation lacking (although this feature is only for Sphinx 0.9.9, so maybe that’s not a problem).
Documentation lacking, but Riddle’s configuration objects mirror Sphinx’s, so it should be pretty easy to figure out. Some of its usage can also be inferred by studying the Configuration model in ThinkingSphinx .
Riddle’s controller object allows you to control the operation of sphinx (starting, stopping, indexing…) in ruby. Documentation is lacking, but some of its usage can be inferred by studying the Test and Configutation models in ThinkingSphinx .