Class: Arelastic::Builders::Filter
- Inherits:
-
Struct
- Object
- Struct
- Arelastic::Builders::Filter
- Defined in:
- lib/arelastic/builders/filter.rb
Instance Attribute Summary collapse
-
#field ⇒ Object
Returns the value of attribute field.
Class Method Summary collapse
Instance Method Summary collapse
- #eq(other) ⇒ Object
- #exists(options = {}) ⇒ Object
- #gt(other) ⇒ Object
- #gte(other) ⇒ Object
- #in(other, options = {}) ⇒ Object
- #lt(other) ⇒ Object
- #lte(other) ⇒ Object
- #missing(options = {}) ⇒ Object
- #not_eq(other) ⇒ Object
- #not_in(other, options = {}) ⇒ Object
- #prefix(other) ⇒ Object
- #regexp(other) ⇒ Object
Instance Attribute Details
#field ⇒ Object
Returns the value of attribute field
3 4 5 |
# File 'lib/arelastic/builders/filter.rb', line 3 def field @field end |
Class Method Details
.[](field) ⇒ Object
5 6 7 |
# File 'lib/arelastic/builders/filter.rb', line 5 def [](field) new(field) end |
Instance Method Details
#eq(other) ⇒ Object
18 19 20 |
# File 'lib/arelastic/builders/filter.rb', line 18 def eq other Arelastic::Queries::Term.new field, other end |
#exists(options = {}) ⇒ Object
47 48 49 |
# File 'lib/arelastic/builders/filter.rb', line 47 def exists( = {}) Arelastic::Queries::Exists.new field, end |
#gt(other) ⇒ Object
63 64 65 |
# File 'lib/arelastic/builders/filter.rb', line 63 def gt other range 'gt' => other end |
#gte(other) ⇒ Object
59 60 61 |
# File 'lib/arelastic/builders/filter.rb', line 59 def gte other range 'gte' => other end |
#in(other, options = {}) ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/arelastic/builders/filter.rb', line 26 def in other, = {} case other when Range if other.exclude_end? range 'gte' => other.begin, 'lt' => other.end else range 'gte' => other.begin, 'lte' => other.end end else Arelastic::Queries::Terms.new field, other, end end |
#lt(other) ⇒ Object
71 72 73 |
# File 'lib/arelastic/builders/filter.rb', line 71 def lt other range 'lt' => other end |
#lte(other) ⇒ Object
67 68 69 |
# File 'lib/arelastic/builders/filter.rb', line 67 def lte other range 'lte' => other end |
#missing(options = {}) ⇒ Object
51 52 53 |
# File 'lib/arelastic/builders/filter.rb', line 51 def missing( = {}) exists().negate end |
#not_eq(other) ⇒ Object
22 23 24 |
# File 'lib/arelastic/builders/filter.rb', line 22 def not_eq other self.class.not eq(other) end |
#not_in(other, options = {}) ⇒ Object
39 40 41 |
# File 'lib/arelastic/builders/filter.rb', line 39 def not_in other, = {} self.class.not self.in(other, ) end |