Nazrin
Nazrin is a Ruby wrapper for Amazon CloudSearch (aws-sdk), with optional ActiveRecord support for easy integration with your Rails application.
Nazrin has the ability of the extent which find what you're looking for...
Installation
Add this line to your application's Gemfile:
gem 'nazrin'
And then execute:
$ bundle
Or install it yourself as:
$ gem install nazrin
Usage
in Ruby on Rails
$ bundle exec rails g nazrin:config
Nazrin.config do |config|
config.debug_mode = false
config.search_endpoint = ''
config.document_endpoint = ''
config.region = ''
config.access_key_id = ''
config.secret_access_key = ''
# currently support kaminari gem
config.pagination = 'kaminari'
end
class Post
include Nazrin::ActiveRecord::Searchable
searchable do
fields [:content]
field(:created_at) { created_at.utc.iso8601 }
end
after_create :update_in_index
after_destroy :delete_from_index
end
Post.search.size(1).start(0).query("(and 'content')").query_parser('structured').execute
=> [#<Post id: 1, content: "content">]
Development
After checking out the repo, run bin/setup
to install dependencies. Then, run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
to create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Contributing
- Fork it ( https://github.com/[my-github-username]/nazrin/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 a new Pull Request