Class: Arelastic::Builders::Queries

Inherits:
Struct
  • Object
show all
Defined in:
lib/arelastic/builders/queries.rb

Constant Summary collapse

MACROS_TO_ARELASTIC =
{
  bool:                Arelastic::Queries::Bool,
  constant_score:      Arelastic::Queries::ConstantScore,
  dis_max:             Arelastic::Queries::DisMax,
  exists:              Arelastic::Queries::Exists,
  field:               Arelastic::Queries::Field,
  filter:              Arelastic::Queries::Filter,
  function_score:      Arelastic::Queries::FunctionScore,
  fuzzy:               Arelastic::Queries::Fuzzy,
  geo_bounding_box:    Arelastic::Queries::GeoBoundingBox,
  geo_distance:        Arelastic::Queries::GeoDistance,
  geo_polygon:         Arelastic::Queries::GeoPolygon,
  geo_shape_polygon:   Arelastic::Queries::GeoShape::Polygon,
  has_child:           Arelastic::Queries::HasChild,
  has_parent:          Arelastic::Queries::HasParent,
  ids:                 Arelastic::Queries::Ids,
  limit:               Arelastic::Queries::Limit,
  match:               Arelastic::Queries::Match,
  match_all:           Arelastic::Queries::MatchAll,
  match_none:          Arelastic::Queries::MatchNone,
  match_phrase:        Arelastic::Queries::MatchPhrase,
  multi_match:         Arelastic::Queries::MultiMatch,
  nested:              Arelastic::Queries::Nested,
  percolate:           Arelastic::Queries::Percolate,
  prefix:              Arelastic::Queries::Prefix,
  query:               Arelastic::Queries::Query,
  query_string:        Arelastic::Queries::QueryString,
  range:               Arelastic::Queries::Range,
  regexp:              Arelastic::Queries::Regexp,
  script:              Arelastic::Queries::Script,
  simple_query_string: Arelastic::Queries::SimpleQueryString,
  term:                Arelastic::Queries::Term,
  terms:               Arelastic::Queries::Terms,
  wildcard:            Arelastic::Queries::Wildcard
}

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



3
4
5
# File 'lib/arelastic/builders/queries.rb', line 3

def name
  @name
end

Class Method Details

.[](field) ⇒ Object



41
42
43
# File 'lib/arelastic/builders/queries.rb', line 41

def [](field)
  new(field)
end

Instance Method Details

#gt(other) ⇒ Object



79
80
81
# File 'lib/arelastic/builders/queries.rb', line 79

def gt other
  range 'gt' => other
end

#gte(other) ⇒ Object



75
76
77
# File 'lib/arelastic/builders/queries.rb', line 75

def gte other
  range 'gte' => other
end

#in(other, options = {}) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/arelastic/builders/queries.rb', line 58

def in other, options = {}
  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
    terms other, options
  end
end

#lt(other) ⇒ Object



87
88
89
# File 'lib/arelastic/builders/queries.rb', line 87

def lt other
  range 'lt' => other
end

#lte(other) ⇒ Object



83
84
85
# File 'lib/arelastic/builders/queries.rb', line 83

def lte other
  range 'lte' => other
end

#missing(options = {}) ⇒ Object



71
72
73
# File 'lib/arelastic/builders/queries.rb', line 71

def missing(options = {})
  exists(options).negate
end