Class: Queries::TermQueryBuilder
- Inherits:
-
QueryBuilder
- Object
- QueryBuilder
- Queries::TermQueryBuilder
- Defined in:
- lib/queries/term_query_builder.rb
Constant Summary collapse
- NAME =
"term"
Instance Method Summary collapse
-
#field_name_expr ⇒ Object
FIELD NAME ########## returns field_name.
-
#initialize(field_name:, value: nil) ⇒ TermQueryBuilder
constructor
@params: field_name: name of the field in the document which is being queried value: is being matched to the data in that field.
- #query ⇒ Object
-
#value_expr ⇒ Object
FIELD VALUE ########## returns value.
Methods inherited from QueryBuilder
Methods included from AttributesReader
Methods included from AbstractQueryBuilder
Constructor Details
#initialize(field_name:, value: nil) ⇒ TermQueryBuilder
@params:
field_name: name of the field in the document which is being queried
value: is being matched to the data in that field.
16 17 18 19 |
# File 'lib/queries/term_query_builder.rb', line 16 def initialize field_name:, value: nil @field_name = field_name @value = value end |
Instance Method Details
#field_name_expr ⇒ Object
FIELD NAME ########## returns field_name
33 34 35 |
# File 'lib/queries/term_query_builder.rb', line 33 def field_name_expr return @field_name end |
#query ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/queries/term_query_builder.rb', line 21 def query query = {} term_query = {} = self.common_query [:value] = @value term_query[@field_name.intern] = query[name.intern] = term_query return query end |
#value_expr ⇒ Object
FIELD VALUE ########## returns value
39 40 41 |
# File 'lib/queries/term_query_builder.rb', line 39 def value_expr return @value end |