Class: Queries::ExistsQueryBuilder

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

Constant Summary collapse

NAME =
"exists"

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(field_name:) ⇒ ExistsQueryBuilder

@params:

field_name: name of the field the existence of whose value is checked


14
15
16
# File 'lib/queries/exists_query_builder.rb', line 14

def initialize field_name:
  @field_name= field_name
end

Instance Attribute Details

#field_nameObject (readonly)

Returns the value of attribute field_name.



8
9
10
# File 'lib/queries/exists_query_builder.rb', line 8

def field_name
  @field_name
end

Instance Method Details

#field_name_exprObject

returns field_name



27
28
29
# File 'lib/queries/exists_query_builder.rb', line 27

def field_name_expr
  return @field_name
end

#queryObject



18
19
20
21
22
23
24
# File 'lib/queries/exists_query_builder.rb', line 18

def query
  query = {}
  exists_query = self.common_query
  exists_query[:field] = @field_name
  query[name.intern] = exists_query
  return query
end