Sha256: 070881f7db21989a2ad7362053561bf32401a09feec6d158e08a33ade9de19cf

Contents?: true

Size: 685 Bytes

Versions: 36

Compression:

Stored size: 685 Bytes

Contents

module SearchFlip
  # The SearchFlip::Sortable mixin provides the chainable #explain method to
  # control elasticsearch query explanations

  module Explainable
    def self.included(base)
      base.class_eval do
        attr_accessor :explain_value
      end
    end

    # Specifies whether or not to enable explanation for each hit on how
    # its score was computed.
    #
    # @example
    #   CommentIndex.explain(true)
    #
    # @param value [Boolean] The value for explain
    #
    # @return [SearchFlip::Criteria] A newly created extended criteria

    def explain(value)
      fresh.tap do |criteria|
        criteria.explain_value = value
      end
    end
  end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
search_flip-4.0.0.beta5 lib/search_flip/explainable.rb
search_flip-4.0.0.beta4 lib/search_flip/explainable.rb
search_flip-3.2.1 lib/search_flip/explainable.rb
search_flip-3.2.0 lib/search_flip/explainable.rb
search_flip-4.0.0.beta3 lib/search_flip/explainable.rb
search_flip-4.0.0.beta2 lib/search_flip/explainable.rb
search_flip-4.0.0.beta1 lib/search_flip/explainable.rb
search_flip-4.0.0.beta lib/search_flip/explainable.rb
search_flip-3.1.2 lib/search_flip/explainable.rb
search_flip-3.1.1 lib/search_flip/explainable.rb
search_flip-3.1.0 lib/search_flip/explainable.rb
search_flip-3.0.0 lib/search_flip/explainable.rb
search_flip-3.0.0.beta6 lib/search_flip/explainable.rb
search_flip-3.0.0.beta5 lib/search_flip/explainable.rb
search_flip-3.0.0.beta4 lib/search_flip/explainable.rb
search_flip-3.0.0.beta3 lib/search_flip/explainable.rb