Module: SearchFlip::Explainable

Included in:
Aggregation, Criteria
Defined in:
lib/search_flip/explainable.rb

Overview

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

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
10
# File 'lib/search_flip/explainable.rb', line 6

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

Instance Method Details

#explain(value) ⇒ SearchFlip::Criteria

Specifies whether or not to enable explanation for each hit on how its score was computed.

Examples:

CommentIndex.explain(true)

Parameters:

  • value (Boolean)

    The value for explain

Returns:



22
23
24
25
26
# File 'lib/search_flip/explainable.rb', line 22

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