Configurable parameters for your elastic search queries. Like strong params, but, like, better.
It works with Tire at the minute and depends on a lot of Rails things. Expect it to change in future.
Add this line to your application's Gemfile:
gem 'configurable_search'
And then execute:
$ bundle
Or install it yourself as:
$ gem install configurable_search
Mix it in to your class to enjoy the DSL niceness...
class AwesomeSearch
include ConfigurableSearch
# State which model should be used for searching
search_for Awesome
# Add the options you want to be passed into the query
# anything not here will be ommitted
search_option :volume, default: 11, label: 'Volume level'
# Define the query itself
def query
search do |s|
...
end
end
end
- Fork it ( http://github.com//configurable_search/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request