{"id":16924995,"url":"https://github.com/tsuwatch/nazrin","last_synced_at":"2025-06-27T10:35:12.511Z","repository":{"id":56461708,"uuid":"45996897","full_name":"tsuwatch/nazrin","owner":"tsuwatch","description":"a Ruby wrapper of Amazon CloudSearch (aws-sdk), with ActiveRecord, Mongoid support for easy integration with your Rails application.","archived":false,"fork":false,"pushed_at":"2020-11-06T01:22:52.000Z","size":99,"stargazers_count":48,"open_issues_count":3,"forks_count":16,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-06-21T02:13:54.532Z","etag":null,"topics":["aws-sdk","cloudsearch","rails","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tsuwatch.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-11-11T17:14:57.000Z","updated_at":"2022-10-07T12:40:18.000Z","dependencies_parsed_at":"2022-08-15T19:10:43.881Z","dependency_job_id":null,"html_url":"https://github.com/tsuwatch/nazrin","commit_stats":null,"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"purl":"pkg:github/tsuwatch/nazrin","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsuwatch%2Fnazrin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsuwatch%2Fnazrin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsuwatch%2Fnazrin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsuwatch%2Fnazrin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsuwatch","download_url":"https://codeload.github.com/tsuwatch/nazrin/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsuwatch%2Fnazrin/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261110603,"owners_count":23111063,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws-sdk","cloudsearch","rails","ruby"],"created_at":"2024-10-13T20:08:34.364Z","updated_at":"2025-06-27T10:35:12.486Z","avatar_url":"https://github.com/tsuwatch.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nazrin\n[![Gem Version](https://badge.fury.io/rb/nazrin.svg)](https://badge.fury.io/rb/nazrin)\n[![Build Status](https://travis-ci.org/tsuwatch/nazrin.svg?branch=master)](https://travis-ci.org/tsuwatch/nazrin)\n[![Coverage Status](https://coveralls.io/repos/tsuwatch/nazrin/badge.svg?branch=readme\u0026service=github)](https://coveralls.io/github/tsuwatch/nazrin?branch=readme)\n[![Code Climate](https://codeclimate.com/github/tsuwatch/nazrin/badges/gpa.svg)](https://codeclimate.com/github/tsuwatch/nazrin)\n\nNazrin is a Ruby wrapper for Amazon CloudSearch (aws-sdk), with ActiveRecord, Mongoid support for easy integration with your Rails application.\n\n\u003e*Nazrin has the ability of the extent which find what you're looking for...*\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'nazrin'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install nazrin\n\n## Usage\n\n### in Ruby on Rails\n\n```ruby\n$ bundle exec rails g nazrin:config # execute before including nazrin to model\n\nNazrin.configure do |config|\n  config.debug_mode = false\n  config.mode = 'production'\n  config.search_endpoint = ''\n  config.document_endpoint = ''\n  config.region = ''\n  config.access_key_id = ''\n  config.secret_access_key = ''\n  config.logger = nil\nend\n```\n\n```ruby\nclass Post \u003c ActiveRecord::Base\n  include Nazrin::Searchable\n\n  # You can override settings\n  searchable_configure do |config|\n    config.search_endpoint = 'http://example.com/override-search-endpoint'\n    config.document_endpoint = 'http://example.com/override-document-endpoint'\n\n    # If you set domain_name, CloudSearch data using index_fields configured for the search domain is loaded, not a database.\n    # So you can use nazrin for plain object\n    config.domain_name = 'my-cloudsearch-domain-name'\n  end\n\n  searchable do\n    fields [:content]\n    field(:created_at) { created_at.utc.iso8601 }\n  end\n\n  after_create :add_to_index\n  after_update :update_in_index\n  after_destroy :delete_from_index\nend\n```\n\n### `.search`\n```ruby\nresult = Post.search(where: :foo, includes: :bar).size(1).start(0).query(\"(and 'content')\").query_parser('structured').execute\n=\u003e [#\u003cPost id: 1, content: \"content\"\u003e]\n# You can access facets\nresult.facets\n=\u003e {}\n```\n\n### `.batch_operation`\n```ruby\npost1 = Post.create\npost2 = Post.create\npost3 = Post.create\npost3.destroy\n\nPost.batch_operation(\n  add: [post1, post2],\n  delete: [post3]\n)\n```\n\n\n### Supported pagination libraries\nIf you want to use other supported pagination libraries, for example, `nazrin-kaminari` generates `Kaminari::PaginatableArray` instead of `Nazrin::PaginatedArray`.\n\n```ruby\ngem 'nazrin'\ngem 'nazrin-kaminari'\n```\n\nCurrently supported libraries\n\n- kaminari: [nazrin-kaminari](https://github.com/tsuwatch/nazrin-kaminari)\n\n### Sandbox mode\n\nWhen there is no instance for development and you don't want to request to CloudSearch\n\n```ruby\nNazrin.config.mode = 'sandbox'\n```\n\n\"sandbox\" mode where it does nothing with any requests and just returns an empty collection for any searches.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo 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](https://rubygems.org).\n\n## Contributing\n\n1. Fork it ( https://github.com/[my-github-username]/nazrin/fork )\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create a new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsuwatch%2Fnazrin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsuwatch%2Fnazrin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsuwatch%2Fnazrin/lists"}