This plugin adds full text search capabilities using Solr to any Rails model.
Usage:
Just include the line below to any of your ActiveRecord models:
acts_as_solr
Or if you want, you can specify only the fields that should be indexed:
acts_as_solr :fields => [:name, :author]
Then to find instances of your model, just do:
Model.find_by_solr(query)
Or if you want to specify the starting row and the number of rows per page:
Model.find_by_solr(query, :start => 0, :rows => 10)
For more control over searching, try adding weight to different fields:
@query = "(name:foo^10) (description:foo^5) (tags:foo)" Model.find_by_solr(@query, :start => 0, :rows => 10)
Please visit this project’s home page for a complete information:
HOWTOs
This plugin adds full text search capabilities using Solr to any Rails model.
Usage:
Just include the line below to any of your ActiveRecord models:
acts_as_solr
Or if you want, you can specify only the fields that should be indexed:
acts_as_solr :fields => [:name, :author]
Then to find instances of your model, just do:
Model.find_by_solr(query)
Or if you want to specify the starting row and the number of rows per page:
Model.find_by_solr(query, :start => 0, :rows => 10)
For more control over searching, try adding weight to different fields:
@query = "(name:foo^10) (description:foo^5) (tags:foo)" Model.find_by_solr(@query, :start => 0, :rows => 10)
Please visit this project’s home page for a complete information:
HOWTOs