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 ⇒ Object
- #gt(other) ⇒ Object
- #gteq(other) ⇒ Object
- #in(other, options = {}) ⇒ Object
- #lt(other) ⇒ Object
- #lteq(other) ⇒ Object
- #missing(options = {}) ⇒ Object
- #not_eq(other) ⇒ Object
- #not_in(other, options = {}) ⇒ Object
- #prefix(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::Filters::Term.new field, other end |
#exists ⇒ Object
47 48 49 |
# File 'lib/arelastic/builders/filter.rb', line 47 def exists Arelastic::Filters::Exists.new field end |
#gt(other) ⇒ Object
59 60 61 |
# File 'lib/arelastic/builders/filter.rb', line 59 def gt other range 'gt' => other end |
#gteq(other) ⇒ Object
55 56 57 |
# File 'lib/arelastic/builders/filter.rb', line 55 def gteq 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::Filters::Terms.new field, other, end end |
#lt(other) ⇒ Object
67 68 69 |
# File 'lib/arelastic/builders/filter.rb', line 67 def lt other range 'lt' => other end |
#lteq(other) ⇒ Object
63 64 65 |
# File 'lib/arelastic/builders/filter.rb', line 63 def lteq other range 'lte' => other end |
#missing(options = {}) ⇒ Object
51 52 53 |
# File 'lib/arelastic/builders/filter.rb', line 51 def missing( = {}) Arelastic::Filters::Missing.new field, 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 |