Class: Arelastic::Queries::GeoDistance
- Inherits:
-
Query
- Object
- Nodes::Node
- Query
- Arelastic::Queries::GeoDistance
- Defined in:
- lib/arelastic/queries/geo_distance.rb
Instance Attribute Summary collapse
-
#distance ⇒ Object
Returns the value of attribute distance.
-
#field ⇒ Object
Returns the value of attribute field.
-
#location ⇒ Object
Returns the value of attribute location.
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
- #as_elastic ⇒ Object
-
#initialize(field, location, distance, options = {}) ⇒ GeoDistance
constructor
A new instance of GeoDistance.
Methods inherited from Query
Methods inherited from Nodes::Node
#==, #convert_to_elastic, #read_option!
Methods included from Arities::Binary
Methods included from Arities::Polyadic
Methods included from Arities::Unary
Constructor Details
#initialize(field, location, distance, options = {}) ⇒ GeoDistance
Returns a new instance of GeoDistance.
5 6 7 8 9 10 |
# File 'lib/arelastic/queries/geo_distance.rb', line 5 def initialize(field, location, distance, = {}) @field = field @location = location @distance = distance @options = end |
Instance Attribute Details
#distance ⇒ Object
Returns the value of attribute distance.
4 5 6 |
# File 'lib/arelastic/queries/geo_distance.rb', line 4 def distance @distance end |
#field ⇒ Object
Returns the value of attribute field.
4 5 6 |
# File 'lib/arelastic/queries/geo_distance.rb', line 4 def field @field end |
#location ⇒ Object
Returns the value of attribute location.
4 5 6 |
# File 'lib/arelastic/queries/geo_distance.rb', line 4 def location @location end |
#options ⇒ Object
Returns the value of attribute options.
4 5 6 |
# File 'lib/arelastic/queries/geo_distance.rb', line 4 def @options end |
Instance Method Details
#as_elastic ⇒ Object
12 13 14 15 16 |
# File 'lib/arelastic/queries/geo_distance.rb', line 12 def as_elastic params = { field => location, "distance" => distance }.update() { "geo_distance" => params } end |