Class: Elasticsearch::API::Response::ExplainNode
- Inherits:
-
Object
- Object
- Elasticsearch::API::Response::ExplainNode
show all
- Extended by:
- Forwardable
- Includes:
- Renderable
- Defined in:
- lib/elasticsearch/api/response/explain_node.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods included from Renderable
#render, #render_as_hash, #render_in_line
Constructor Details
#initialize(score:, description:, details: [], level: 0) ⇒ ExplainNode
Returns a new instance of ExplainNode.
15
16
17
18
19
20
21
|
# 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
|
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
11
12
13
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 11
def children
@children
end
|
#description ⇒ Object
Returns the value of attribute description.
10
11
12
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 10
def description
@description
end
|
#details ⇒ Object
Returns the value of attribute details.
10
11
12
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 10
def details
@details
end
|
#level ⇒ Object
Returns the value of attribute level.
10
11
12
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 10
def level
@level
end
|
#score ⇒ Object
Returns the value of attribute score.
10
11
12
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 10
def score
@score
end
|
Instance Method Details
#as_json ⇒ Object
78
79
80
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 78
def as_json
{ score: score }.merge(description.as_json)
end
|
#boost? ⇒ Boolean
54
55
56
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 54
def boost?
type == "boost"
end
|
#clone_with(attributes = {}) ⇒ Object
23
24
25
26
27
28
29
30
31
32
|
# 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
|
#func? ⇒ Boolean
42
43
44
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 42
def func?
type == "func"
end
|
#func_score? ⇒ Boolean
62
63
64
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 62
def func_score?
type == "func score"
end
|
#has_children? ⇒ Boolean
74
75
76
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 74
def has_children?
children.any?
end
|
#match? ⇒ Boolean
46
47
48
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 46
def match?
type == "match"
end
|
#match_all? ⇒ Boolean
50
51
52
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 50
def match_all?
type == "match" && field == "*" && value == "*"
end
|
#max_boost? ⇒ Boolean
58
59
60
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 58
def max_boost?
type == "maxBoost"
end
|
#min? ⇒ Boolean
38
39
40
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 38
def min?
type == "min"
end
|
#query_boost? ⇒ Boolean
66
67
68
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 66
def query_boost?
type == "queryBoost"
end
|
#score_one? ⇒ Boolean
34
35
36
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 34
def score_one?
score == 1.0
end
|
#script? ⇒ Boolean
70
71
72
|
# File 'lib/elasticsearch/api/response/explain_node.rb', line 70
def script?
type == "script"
end
|