Sha256: c30183568ea6c07fbbf81a89edf18a3326ee2b1fe1017bd55125f4249a29b71c

Contents?: true

Size: 720 Bytes

Versions: 20

Compression:

Stored size: 720 Bytes

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.config.search_per_page,
          )
        end
      end
    end
  end
end

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
rocket_cms-0.9.1 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.13 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.12 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.11 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.10 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.9 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.8 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.7 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.6 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.5 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.4 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.3 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.1 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.0 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.0.pre.6 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.0.pre.5 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.0.pre.4 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.0.pre.3 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.0.pre.2 lib/rocket_cms/controllers/search.rb
rocket_cms-0.8.0.pre.1 lib/rocket_cms/controllers/search.rb