class Elasticsearch::API::Response::ExplainNode

Attributes

children[RW]
description[R]
details[R]
level[R]
score[R]

Public Class Methods

new(score:, description:, details: [], level: 0) click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 15
def initialize(score:, description:, details: [], level: 0)
  @score = score
  @description = description
  @details = details
  @level = level
  @children = []
end

Public Instance Methods

as_json() click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 90
def as_json
  { score: score }.merge(description.as_json)
end
boost?() click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 66
def boost?
  type == "boost"
end
clone_with(attributes = {}) click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 23
def clone_with(attributes = {})
  node = self.class.new(
    score: attributes[:score] || score,
    description: attributes[:description] || description,
    details: attributes[:details] || details,
    level: attributes[:level] || level
  )
  node.children = attributes[:children] || children
  node
end
constant?() click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 54
def constant?
  type == "constant"
end
func?() click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 46
def func?
  type == "func"
end
func_score?() click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 74
def func_score?
  type == "func score"
end
has_children?() click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 86
def has_children?
  children.any?
end
match?() click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 58
def match?
  type == "match"
end
match_all?() click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 62
def match_all?
  type == "match" && field == "*" && value == "*"
end
max_boost?() click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 70
def max_boost?
  type == "maxBoost"
end
min?() click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 42
def min?
  type == "min"
end
product?() click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 50
def product?
  type == "product"
end
query_boost?() click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 78
def query_boost?
  type == "queryBoost"
end
score?() click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 38
def score?
  type == "score"
end
score_one?() click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 34
def score_one?
  score == 1.0
end
script?() click to toggle source
# File lib/elasticsearch/api/response/explain_node.rb, line 82
def script?
  type == "script"
end