Class: Elastic::Nodes::Sort
Constant Summary
Concerns::Sortable::MODES, Concerns::Sortable::ORDER
Instance Attribute Summary collapse
Instance Method Summary
collapse
#add_sort, #reset_sorts, #sorts
Methods inherited from Base
#==
#pick_nodes
Instance Attribute Details
#child ⇒ Object
Returns the value of attribute child.
5
6
7
|
# File 'lib/elastic/nodes/sort.rb', line 5
def child
@child
end
|
Instance Method Details
#add_score_sort(order: :desc) ⇒ Object
7
8
9
|
# File 'lib/elastic/nodes/sort.rb', line 7
def add_score_sort(order: :desc)
add_sort('_score', order: order)
end
|
#clone ⇒ Object
11
12
13
|
# File 'lib/elastic/nodes/sort.rb', line 11
def clone
prepare_clone(super, child.try(:clone))
end
|
#handle_result(_raw, _formatter) ⇒ Object
29
30
31
|
# File 'lib/elastic/nodes/sort.rb', line 29
def handle_result(_raw, _formatter)
@child.handle_result(_raw, _formatter)
end
|
#render(_options = {}) ⇒ Object
23
24
25
26
27
|
# File 'lib/elastic/nodes/sort.rb', line 23
def render(_options = {})
hash = child.render(_options)
hash['sort'] = render_sorts
hash
end
|
#simplify ⇒ Object
15
16
17
18
19
20
21
|
# File 'lib/elastic/nodes/sort.rb', line 15
def simplify
if registered_sorts.empty?
child.try(:simplify)
else
prepare_clone(super, child.try(:simplify))
end
end
|
#traverse(&_block) ⇒ Object
33
34
35
36
|
# File 'lib/elastic/nodes/sort.rb', line 33
def traverse(&_block)
super
@child.traverse(&_block)
end
|