class Druid::DimensionFilter

Public Instance Methods

'!='(value)
Alias for: neq
'=='(value)
Alias for: eq
<(value) click to toggle source
# File lib/druid/filter.rb, line 230
def <(value)
  JavascriptFilter.new_comparison(@dimension, '<', value)
end
<=(value) click to toggle source
# File lib/druid/filter.rb, line 238
def <=(value)
  JavascriptFilter.new_comparison(@dimension, '<=', value)
end
>(value) click to toggle source
# File lib/druid/filter.rb, line 226
def >(value)
  JavascriptFilter.new_comparison(@dimension, '>', value)
end
>=(value) click to toggle source
# File lib/druid/filter.rb, line 234
def >=(value)
  JavascriptFilter.new_comparison(@dimension, '>=', value)
end
bound(params) click to toggle source
# File lib/druid/filter.rb, line 169
def bound(params)
  BoundFilter.new(@dimension, params)
end
eq(value) click to toggle source
# File lib/druid/filter.rb, line 177
def eq(value)
  case value
  when ::Array
    self.in(value)
  when ::Regexp
    self.regexp(value)
  else
    @type = 'selector'
    @value = value
  end
  self
end
Also aliased as: '=='
filter_multiple(values, operator, method) click to toggle source
# File lib/druid/filter.rb, line 206
def filter_multiple(values, operator, method)
  ::Kernel.raise 'Values cannot be empty' if values.empty?
  return self.__send__(method, values[0]) if values.length == 1
  BooleanFilter.new({
    type: operator,
    fields: values.map do |value|
      DimensionFilter.new(dimension: @dimension).__send__(method, value)
    end
  })
end
in(*args) click to toggle source
# File lib/druid/filter.rb, line 198
def in(*args)
  filter_multiple(args.flatten, 'or', :eq)
end
in_circ(bounds) click to toggle source
# File lib/druid/filter.rb, line 165
def in_circ(bounds)
  CircFilter.new(@dimension, bounds)
end
in_rec(bounds) click to toggle source
# File lib/druid/filter.rb, line 161
def in_rec(bounds)
  RecFilter.new(@dimension, bounds)
end
javascript(js) click to toggle source
# File lib/druid/filter.rb, line 242
def javascript(js)
  JavascriptFilter.new(@dimension, js)
end
neq(value) click to toggle source
# File lib/druid/filter.rb, line 192
def neq(value)
  return !self.eq(value)
end
Also aliased as: '!='
nin(*args) click to toggle source
# File lib/druid/filter.rb, line 202
def nin(*args)
  filter_multiple(args.flatten, 'and', :neq)
end
Also aliased as: not_in
not_in(*args)
Alias for: nin
regexp(r) click to toggle source
# File lib/druid/filter.rb, line 219
def regexp(r)
  r = ::Regexp.new(r) unless r.is_a?(::Regexp)
  @pattern = r.inspect[1...-1] #to_s doesn't work
  @type = 'regex'
  self
end