{"id":13778827,"url":"https://github.com/refinery/refinerycms-search","last_synced_at":"2025-04-06T08:15:54.214Z","repository":{"id":42509134,"uuid":"482919","full_name":"refinery/refinerycms-search","owner":"refinery","description":"Search Plugin for RefineryCMS","archived":false,"fork":false,"pushed_at":"2022-05-03T03:24:03.000Z","size":106,"stargazers_count":64,"open_issues_count":8,"forks_count":60,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-03-30T07:11:12.528Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/refinery.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-01-21T22:30:48.000Z","updated_at":"2024-11-10T18:46:31.000Z","dependencies_parsed_at":"2022-09-21T19:28:19.394Z","dependency_job_id":null,"html_url":"https://github.com/refinery/refinerycms-search","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refinery%2Frefinerycms-search","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refinery%2Frefinerycms-search/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refinery%2Frefinerycms-search/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/refinery%2Frefinerycms-search/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/refinery","download_url":"https://codeload.github.com/refinery/refinerycms-search/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247451666,"owners_count":20940944,"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":[],"created_at":"2024-08-03T18:00:57.898Z","updated_at":"2025-04-06T08:15:54.182Z","avatar_url":"https://github.com/refinery.png","language":"Ruby","funding_links":[],"categories":["Refinery team extensions"],"sub_categories":["Frontoffice extensions"],"readme":"# Refinery CMS Search [![Build Status](https://travis-ci.org/refinery/refinerycms-search.svg?branch=master)](https://travis-ci.org/refinery/refinerycms-search)\n\nSimple search engine for [Refinery CMS](http://refinerycms.com).\nBy default it supports search in `Refinery::Page`, and `Refinery::Blog::Post` (if installed), but it can be easily configured for other Rails models too.\n\nThis version of `refinerycms-search` supports Refinery 3.x and Rails 4.1.x.\nFor Refinery 2.1.x and Rails 3.x, use the [2-1-stable branch](http://github.com/refinery/refinerycms-search/tree/2-1-stable).\n\nPowered by: [acts_as_indexed](https://github.com/dougal/acts_as_indexed) and [refinerycms-acts-as-indexed](https://github.com/refinery/refinerycms-acts-as-indexed) -\nCheck his readme and documentation for more info on how it works.\n\n\n### In summary you can\n\n* Search in `Refinery::Page` and `Refinery::Blog::Post` models\n* Add others models in your configuration\n* Scope search query with a special method\n* Use a custom search page URL\n* Paginate the search result\n\nWhat it can't do :\n* It can't search all languages in the same query: it only display the results of the current locale.\n\n## Requirements\n\nRefinery CMS version 4.0.0 or above.\n\n## Installation\n\nOpen up your ``Gemfile`` and at the bottom, add this line:\n\n```ruby\ngem 'refinerycms-search', github: 'refinery/refinerycms-search', branch: 'master'\n```\n\nNow, run ``bundle install``\n\nNext, to install the search plugin run:\n\n    rails generate refinery:search\n\nRun database migrations:\n\n    rake db:migrate\n\nFinally seed your database and you're done.\n\n    rake db:seed\n\n## Index records\n\nYou will have to **RE-SAVE** all records that have not been indexed before.\n\nYou can do it easily with a command like this in rails console :\n\n```ruby\nRefinery::Page.all(\u0026:save)\n```\n\n## Search form\n\nA sample search form can be found in [views/refinery/shared/_search.html.erb](https://github.com/refinery/refinerycms-search/blob/master/app/views/refinery/shared/_search.html.erb).\nYou can either use this partial directly, or copy the appropriate parts.\n\n## Searchable models\n\nThe default installation will search in `Refinery::Page` and `Refinery::Blog::Post` (if installed).\nIf you wish to find results in other plugins you have created or installed, you can specify these in `config/initializers/refinery/search.rb` like so:\n\n```ruby\nconfig.enable_for = ['Refinery::Page']\n```\n\nSimply add any additional models you wish to search to this array.  For example, if you have the [portfolio plugin](http://github.com/resolve/refinerycms-portfolio) installed:\n\n```ruby\nconfig.enable_for = ['Refinery::Page', 'Refinery::PortfolioEntry']\n```\n\nThe above line will add indexing to PortfolioEntry in the portfolio plugin, which does not come indexed.\n\nAny model you wish to search will need to be indexed using acts as indexed. To add indexing, simple add:\n\n```ruby\nacts_as_indexed :fields =\u003e [:title, :body]\n```\n\nIf your model doesn't use a `:title` attribute, remember to add an `alias_attribute`:\n\n```ruby\nalias_attribute :title, :name #for example\n```\n\nYou can use any public method, as well. So if you have `:first_name` and `:last_name` but a method like `name` to join them, it can be indexed.\n\n```ruby\nacts_as_indexed :fields =\u003e [:name, :biography]\n\n#...\n\ndef name\n  [first_name, last_name].reject(\u0026:blank?).join(' ')\nend\n```\n\nYou will need to replace the indexed fields with those appropriate for your model.\n\nIf you wish to override the url used in the search results just add a `url` method to your model and the result of this method will be used instead.\n\n## Displaying a friendlier name for your model\n\nJust define the method `friendly_search_name` to override what is displayed\nfor each search result for your model as per [the implementing pull request](https://github.com/refinery/refinerycms-search/pull/38).\n\n```ruby\ndef friendly_search_name\n  \"Document\"\nend\n```\n\n## Use `refinery_search_scope` on searchable models\n\nIf you want to add a custom scope on a searchable model, you can use the method `refinery_search_scope` in your model.\n\n```ruby\n# app/decorators/models/refinery/page_decorator.rb\nRefinery::Page.class_eval do\n  def self.refinery_search_scope\n    live\n  end\nend\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frefinery%2Frefinerycms-search","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frefinery%2Frefinerycms-search","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frefinery%2Frefinerycms-search/lists"}