Class: Queries::NestedSortQueryBuilder

Inherits:
QueryBuilder show all
Defined in:
lib/queries/nested_sort_query_builder.rb

Constant Summary collapse

NAME =
"nested"

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from QueryBuilder

#boost

Methods included from AttributesReader

#attributes

Methods included from AbstractQueryBuilder

#do_equals?, #name

Constructor Details

#initialize(path:, inner_query:) ⇒ NestedSortQueryBuilder

@params:

  path: The query path points to the nested object path.
  inner_query: query includes the query that will run on the nested docs matching the direct path, and joining with the root parent docs

Any fields referenced inside the query must use the complete path (fully qualified)


16
17
18
19
# File 'lib/queries/nested_sort_query_builder.rb', line 16

def initialize path:, inner_query:
  @path = path
  @inner_query = inner_query
end

Instance Attribute Details

#inner_queryObject (readonly)

Returns the value of attribute inner_query.



7
8
9
# File 'lib/queries/nested_sort_query_builder.rb', line 7

def inner_query
  @inner_query
end

#pathObject (readonly)

Returns the value of attribute path.



7
8
9
# File 'lib/queries/nested_sort_query_builder.rb', line 7

def path
  @path
end

Instance Method Details

#inner_query_exprObject

returns inner_query



34
35
36
# File 'lib/queries/nested_sort_query_builder.rb', line 34

def inner_query_expr
  return @inner_query
end

#path_exprObject

returns path



29
30
31
# File 'lib/queries/nested_sort_query_builder.rb', line 29

def path_expr
  return @path
end

#queryObject



21
22
23
24
25
26
# File 'lib/queries/nested_sort_query_builder.rb', line 21

def query
  nested_query = self.common_query
  nested_query[:path] = @path if @path.present?
  nested_query[:filter] = @inner_query.query if @inner_query.present?
  return nested_query
end

#score_mode_exprObject

returns score_mode



39
40
41
# File 'lib/queries/nested_sort_query_builder.rb', line 39

def score_mode_expr
  return @score_mode
end