Sha256: 5e999d4502efa9c7aaf2a1811c898a4402280e7159f7f231c7889538436c7ddd
Contents?: true
Size: 1.78 KB
Versions: 8
Compression:
Stored size: 1.78 KB
Contents
module RocketCMS module Controllers module Search extend ActiveSupport::Concern # def index # if params[:query].blank? # @results = [] # else # @results = Mongoid::Elasticsearch.search({ # body: { # query: { # query_string: { # query: Mongoid::Elasticsearch::Utils.clean(params[:query]) # } # }, # highlight: { # fields: { # name: {}, # content: {} # } # } # }}, # page: params[:page], # per_page: RocketCMS.configuration.search_per_page, # ) # end # end def index if params[:q].blank? @results = [] else query = params[:q].to_s.gsub(/\P{Word}+/, ' ').gsub(/ +/, ' ').strip @results = Page.search(query, per_page: 10, highlight: true, suggest: true, page: params[:page], per_page: RocketCMS.configuration.search_per_page ) # @results = Mongoid::Elasticsearch.search({ # body: { # query: { # query_string: { # query: Mongoid::Elasticsearch::Utils.clean(params[:query]) # } # }, # highlight: { # fields: { # name: {}, # content: {} # } # } # }}, # page: params[:page], # per_page: RocketCMS.config.search_per_page, # ) end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems