{"id":13520271,"url":"https://github.com/paractmol/tagliani","last_synced_at":"2026-04-12T06:31:51.928Z","repository":{"id":45102555,"uuid":"187075345","full_name":"paractmol/tagliani","owner":"paractmol","description":"Blazing fast ActiveRecord library to create tags using ElasticSearch","archived":false,"fork":false,"pushed_at":"2023-01-20T03:42:29.000Z","size":51,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-25T05:32:09.624Z","etag":null,"topics":["activerecord","elasticsearch","rails","redis","ruby","tags"],"latest_commit_sha":null,"homepage":"https://fadein.xyz/","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/paractmol.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-16T17:47:54.000Z","updated_at":"2022-11-27T22:42:20.000Z","dependencies_parsed_at":"2023-02-11T23:30:44.633Z","dependency_job_id":null,"html_url":"https://github.com/paractmol/tagliani","commit_stats":null,"previous_names":["rudkovskyi/tagliani","rrubyist/tagliani"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paractmol%2Ftagliani","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paractmol%2Ftagliani/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paractmol%2Ftagliani/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/paractmol%2Ftagliani/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/paractmol","download_url":"https://codeload.github.com/paractmol/tagliani/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241263404,"owners_count":19936057,"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":["activerecord","elasticsearch","rails","redis","ruby","tags"],"created_at":"2024-08-01T05:02:16.184Z","updated_at":"2025-12-31T01:10:37.641Z","avatar_url":"https://github.com/paractmol.png","language":"Ruby","readme":"# Tagliani\n\nBlazing fast Ruby alternative to `acts-as-taggable-on` and other similar gems. Instead of million of records in the database it uses powerful ElasticSearch, which gives a very fast and scalable solution with a search capabilities of ElasticSearch.\n\n## Installation\n\nAll you need is to add in your `Gemfile` the follwing line.\n\n```ruby\ngem 'tagliani'\n```\n\nAnd run `bundle install` command.\n\n### Requirements\n\n* ActiveRecord\n* redis-client\n* elasticsearch\n\nTo run this gem it is required to have ActiveRecord.\n\n## Configuration\n\nIn your rails app `config/initializers` create `tagliani.rb` with the following content\n\n```ruby\nTagliani.configure do |config|\n  config.elasticsearch.url = \"http://localhost:9200\" # URL of your ElasticSearch service, by default set to this endpoint\n  config.elasticsearch.index = \"tagliani_#{Rails.env}\" # Index name\n  config.elasticsearch.refresh = true # false by default\n  config.elasticsearch.log = true # false by default\n  config.redis.url = \"redis://localhost:6379/tagliani\" # By default set to this endpoint\n  config.redis.queue = \"tagliani\" # By default set to this queue name\n  config.redis.length = 200 # By default set to 200. It is a queue length per bulk that is going to be sent to ElasticSearch\nend\n```\n\n## Search\n\nLet's say inside the Rails application you have a model with a name \"Hashtag\", that represents all the tags attached to the model \"Tweet\".\n\n```ruby\nclass Hashtag \u003c ActiveRecord::Base\n  include Tagliani::Concerns::Search\nend\n\nclass Tweet \u003c ActiveRecord::Base\n  taggable tag_kls: \"Hashtag\"\nend\n```\n\n*tag_kls is optional. By default it set to `Tag` model*\n\nTo attach the tag simply execute:\n\n```ruby\ntweet = Tweet.create(body: \"Follow @rrubyist on Twitter\")\ntweet.tags.add(name: '#followme')\n```\n\nTo list the attached tags you can run:\n\n```ruby\ntweet.tags\n```\n\nIt will return you an array of `Hashtag` objects attached to the `Tweet` model.\n\n```ruby\n[#\u003cHashtag id: 2, name: \"#followme\", sticker: \"default\"\u003e]\n```\n\nIf you want to search for all tweets attached to the `Hashtag` model with a name `#followme` you can use public `search` method defined in class.\n\n*You don't have to specify `tag_kls`, unless you have multiple models that act as Tag model*\n\n```ruby\nHashtag.search(where: { tag_name: ['#followme'], tag_kls: ['Hashtag'] }\n```\n\nTag name represents the `name` field of the `Hashtag` model.\n\n```ruby\n[#\u003cTweet id: 3, body: \"Tweet #0\"\u003e, #\u003cTweet id: 4, body: \"Tweet #1\"\u003e, \n#\u003cTweet id: 5, body: \"Tweet #2\"\u003e, #\u003cTweet id: 6, body: \"Follow @rrubyist on Twitter\"\u003e]\n```\n\n### More search\n\nIn fact, you can do so much more with it. You are in power of using all the abilities of ElasticSearch. For example, you can search using a `*`. You can write `pro*` and match all tags that contain this part of the word at the beginning of the name tag.\n\n```ruby\nproducer.tags.search(where: { tag_name: [\"pro*\"] })\n=\u003e [#\u003cTag id: 3, name: \"professor\", sticker: \"default\"\u003e, #\u003cTag id: 4, name: \"professional\", sticker: \"default\"\u003e]\n```\n\n## Asyncronous bulk index\n\nFor a non-blocking processes you can enable option to index jobs in background queue.\n\n```ruby\nclass Artist \u003c ActiveRecord::Base\n  has_many :albums\n  tagliani async: true\nend\n```\n\nTo index in bulks, simply execute:\n```ruby\nTagliani::Search::Index.bulk!\n```\n\n## Inherit tags from models\n\nYou can specify the models you want to inherit tags from by adding an option `:inherit` with a list of models in the `taggable` method.\n\n```ruby\nclass Album \u003c ActiveRecord::Base\n  has_many :songs\n  belongs_to :artist\n  belongs_to :producer\n\n  taggable inherit: %i[artist producer]\nend\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/rudkovskyi/tagliani. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Tagliani project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/rudkovskyi/tagliani/blob/master/CODE_OF_CONDUCT.md).\n","funding_links":[],"categories":["Ruby"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparactmol%2Ftagliani","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fparactmol%2Ftagliani","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fparactmol%2Ftagliani/lists"}