Sha256: 53bf08f209334dd5807499f0c2ddd599541fb2b6fd2a89ed63e6d07e9b890406
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
require "alchemy_cms" require "pg_search" module Alchemy module PgSearch class Engine < ::Rails::Engine engine_name "alchemy_pg_search" config.to_prepare do Dir.glob(Alchemy::PgSearch::Engine.root.join("app", "extensions", "**", "*_extension.rb")) do |c| require_dependency(c) end # We need to have the search methods present in all Alchemy controllers Alchemy::BaseController.send(:include, Alchemy::PgSearch::ControllerMethods) # reindex the page after it was published Alchemy.publish_targets << Alchemy::PgSearch::IndexPageJob # enable searchable flag in page form Alchemy.enable_searchable = true # configure multiselect to find also partial words # @link https://github.com/Casecommons/pg_search#searching-using-different-search-features ::PgSearch.multisearch_options = { using: { tsearch: { prefix: true, dictionary: Alchemy::PgSearch.config.fetch(:dictionary, "simple"), tsvector_column: 'searchable_content' } } } end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alchemy-pg_search-5.1.0 | lib/alchemy/pg_search/engine.rb |