Getting Started
Requirements
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:
require 'riddle'
require 'riddle/0.9.8'
Or if you’re using using 0.9.9:
require 'riddle'
require 'riddle/0.9.9'
Searching
You’ll need an active Client instance:
client = Riddle::Client.new 'localhost', 9312
Obviously, change the address and port to suit, if necessary.
Searching is done via the query
method:
client.query 'search terms', 'index_name', 'comment'
The index name and comment are optional - the first will default to all
indexes ('*'
), 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.
client.match_mode = :extended
client.filters << Riddle::Client::Filter.new('attribute', [1,
2])
Excerpts
Documentation lacking.
Updates
Documentation lacking.
Status
Documentation lacking (although this feature is only for Sphinx 0.9.9, so maybe that’s not a problem).
Configuration
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 .
Controller
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 .