class Sort::FieldSortBuilder
Constants
- NAME
Public Class Methods
new(field_name: @field_name = field_name)
click to toggle source
# File lib/sort/field_sort_builder.rb, line 8 def initialize field_name: @field_name = field_name end
Public Instance Methods
field_name_expr()
click to toggle source
returns field_name
# File lib/sort/field_sort_builder.rb, line 24 def field_name_expr return @field_name end
missing(missing)
click to toggle source
sets missing
# File lib/sort/field_sort_builder.rb, line 44 def missing missing @missing = missing.is_a?(Missing) ? missing.missing : missing return self end
missing_expr()
click to toggle source
returns missing
# File lib/sort/field_sort_builder.rb, line 40 def missing_expr return @missing end
nested_sort(nested_sort)
click to toggle source
sets nested_sort
# File lib/sort/field_sort_builder.rb, line 33 def nested_sort nested_sort raise ArgumentError.new("pass a nested query object") if nested_sort.name != "nested" @nested_sort = nested_sort return self end
nested_sort_expr()
click to toggle source
returns nested_sort
# File lib/sort/field_sort_builder.rb, line 29 def nested_sort_expr return @nested_sort end
query()
click to toggle source
# File lib/sort/field_sort_builder.rb, line 12 def query query = {} field_query = self.common_query field_query[:mode] = @sort_mode if @sort_mode.present? field_query[:missing] = @missing if @missing.present? field_query[:unmapped_type] = @unmapped_type if @unmapped_type.present? field_query[:nested] = @nested_sort.query[:nested] if @nested_sort.present? query[@field_name.intern] = field_query return query end
sort_mode(sort_mode)
click to toggle source
sets sort_mode
# File lib/sort/field_sort_builder.rb, line 54 def sort_mode sort_mode @sort_mode = sort_mode.sort_mode return self end
sort_mode_expr()
click to toggle source
returns sort_mode
# File lib/sort/field_sort_builder.rb, line 50 def sort_mode_expr return @sort_mode end
unmapped_type(unmapped_type)
click to toggle source
sets unmapped_type
# File lib/sort/field_sort_builder.rb, line 64 def unmapped_type unmapped_type @unmapped_type = unmapped_type return self end
unmapped_type_expr()
click to toggle source
returns unmapped_type
# File lib/sort/field_sort_builder.rb, line 60 def unmapped_type_expr return @unmapped_type end