Sha256: afa59f68d207370f8d06b0c8544bc1b07d51f2ab1e1e0eacf25dad500d9a5c76

Contents?: true

Size: 767 Bytes

Versions: 1

Compression:

Stored size: 767 Bytes

Contents

require 'active_support/concern'

module Georgia
  module Indexer
    module TireAdapter
      module ActsAsTaggableOnTagExtension
        extend ActiveSupport::Concern

        included do

          include ::Tire::Model::Search
          include ::Tire::Model::Callbacks

          def to_indexed_json
            {name: name}.to_json
          end

          def self.search_index params
            search(page: (params[:page] || 1), per_page: (params[:per] || 10)) do
              if params[:q].present?
                query do
                  boolean do
                    must { string params[:q], default_operator: "AND" }
                  end
                end
              end
            end
          end

        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
georgia-0.7.8 lib/georgia/indexer/extensions/tire_adapter/acts_as_taggable_on/tag.rb