Sha256: 2bba9856e06375a9576de325e0f1fb20da68058bb125d0b92c9b4a5df7fef50a

Contents?: true

Size: 650 Bytes

Versions: 1

Compression:

Stored size: 650 Bytes

Contents

require 'active_support/concern'

module Georgia
  module Concerns
    module Searchable
      extend ActiveSupport::Concern

      included do

        include Elasticsearch::Model
        include Elasticsearch::Model::Callbacks

        def as_indexed_json options={}
          self.as_json(
            only: [:id, :updated_at, :slug, :type, :template],
            methods: [:title, :text, :excerpt, :keyword_list, :tag_list]
            )
        end

      end

      module ClassMethods

        def search_conditions params
          Georgia::PageSearch.new(params.merge(type: self.to_s)).definition
        end

      end

    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
georgia-0.8.0 app/models/georgia/concerns/searchable.rb