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-3.9.0 lib/search_flip/explainable.rb
search_flip-4.0.0.beta16 lib/search_flip/explainable.rb
search_flip-4.0.0.beta15 lib/search_flip/explainable.rb
search_flip-4.0.0.beta14 lib/search_flip/explainable.rb
search_flip-3.8.0 lib/search_flip/explainable.rb
search_flip-4.0.0.beta13 lib/search_flip/explainable.rb
search_flip-3.7.2 lib/search_flip/explainable.rb
search_flip-4.0.0.beta12 lib/search_flip/explainable.rb
search_flip-3.7.1 lib/search_flip/explainable.rb
search_flip-4.0.0.beta11 lib/search_flip/explainable.rb
search_flip-3.7.0 lib/search_flip/explainable.rb
search_flip-4.0.0.beta10 lib/search_flip/explainable.rb
search_flip-3.6.0 lib/search_flip/explainable.rb
search_flip-3.5.0 lib/search_flip/explainable.rb
search_flip-4.0.0.beta9 lib/search_flip/explainable.rb
search_flip-4.0.0.beta8 lib/search_flip/explainable.rb
search_flip-3.4.0 lib/search_flip/explainable.rb
search_flip-3.3.0 lib/search_flip/explainable.rb
search_flip-4.0.0.beta7 lib/search_flip/explainable.rb
search_flip-4.0.0.beta6 lib/search_flip/explainable.rb