class Sort::NestedSortBuilder
Constants
- NAME
Public Class Methods
new(path: @path = path)
click to toggle source
@params:
filter: A filter that the inner objects inside the nested path should match with in order for its field values to be taken into account by sorting. max_children: The maximum number of children to consider per root document when picking the sort value. nested_sort: Same as top-level nested but applies to another nested path within the current nested object. path: Defines on which nested object to sort. The actual sort field must be a direct field inside this nested object.
# File lib/sort/nested_sort_builder.rb, line 16 def initialize path: @path = path @filter = nil @max_children = nil @nested_sort = nil end
Public Instance Methods
filter(filter)
click to toggle source
sets filter
# File lib/sort/nested_sort_builder.rb, line 42 def filter filter @filter = filter return self end
filter_expr()
click to toggle source
returns filter
# File lib/sort/nested_sort_builder.rb, line 38 def filter_expr return @filter end
max_children(max_children)
click to toggle source
sets max_children
# File lib/sort/nested_sort_builder.rb, line 52 def max_children max_children @max_children = max_children return self end
max_children_expr()
click to toggle source
returns max_children
# File lib/sort/nested_sort_builder.rb, line 48 def max_children_expr return @max_children end
nested_sort(nested_sort)
click to toggle source
sets nested_sort
# File lib/sort/nested_sort_builder.rb, line 62 def nested_sort nested_sort @nested_sort = nested_sort return self end
nested_sort_expr()
click to toggle source
returns nested_sort
# File lib/sort/nested_sort_builder.rb, line 58 def nested_sort_expr return @nested_sort end
path_expr()
click to toggle source
returns path
# File lib/sort/nested_sort_builder.rb, line 33 def path_expr return @path end
query()
click to toggle source
# File lib/sort/nested_sort_builder.rb, line 23 def query query = self.common_query query[:path] = @path query[:filter] = @filter.query if @filter.present? query[:nested] = @nested_sort.query if @nested_sort.present? query[:max_children] = @max_children if @max_children.present? return query end