Skip to content

ActiveRecord extension for IndexTank (similar syntax to ThinkingSphinx)

License

Notifications You must be signed in to change notification settings

flaptor/thinkingtank

Repository files navigation

ThinkingTank

See documentation in: indextank.com/documentation/thinkingtank

ActiveRecord extension that allows to define models that should be indexed in an existing IndexTank index. It supports a very similar syntax to ThinkingSphinx allowing to easily port an existing project.

Every indexable model should include a define_index block in its class definition. This block supports the indexes :method and receives a field name.

Model classes now have a search method that receives one or more string arguments with query strings (according to the query specifications) and supports the :conditions argument as a hash from field name to query string.

In order for this extension to work you need to define a config/indextank.yml in your application with the api_key and index_name settings for each environment (similar to config/database.yml).

Indexed fields in ActiveRecord are prepended an underscore when sent to IndexTank so if you plan to write query strings that use your field names you will have to prepend the underscore to the field names.

Rails 2

In order for the ThinkingTank to be available you need to add:

require 'thinkingtank'
require 'thinkingtank/tasks'

to your Rakefile.

Rails 3

Just add

gem 'thinkingtank'

to your Gemfile.

Rails 2 and 3

For both versions of Rails, you can use the following task to reindex your entire database:

rake indextank:reindex

Copyright © 2011 Flaptor Inc.

About

ActiveRecord extension for IndexTank (similar syntax to ThinkingSphinx)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages