Class: Couchbase::SearchSort::SearchSortGeoDistance
- Inherits:
-
Couchbase::SearchSort
- Object
- Couchbase::SearchSort
- Couchbase::SearchSort::SearchSortGeoDistance
- Defined in:
- lib/couchbase/search_options.rb
Instance Attribute Summary collapse
-
#desc ⇒ Boolean
If descending order should be applied.
-
#field ⇒ String
readonly
Name of the field to sort by.
- #latitude ⇒ Float readonly
- #longitude ⇒ Float readonly
- #unit ⇒ :meters, ...
Instance Method Summary collapse
-
#initialize(field, longitude, latitude) {|| ... } ⇒ SearchSortGeoDistance
constructor
A new instance of SearchSortGeoDistance.
- #to_json(*args) ⇒ Object private
Methods inherited from Couchbase::SearchSort
field, geo_distance, id, score
Constructor Details
#initialize(field, longitude, latitude) {|| ... } ⇒ SearchSortGeoDistance
Returns a new instance of SearchSortGeoDistance.
1214 1215 1216 1217 1218 1219 1220 |
# File 'lib/couchbase/search_options.rb', line 1214 def initialize(field, longitude, latitude) super() @field = field @longitude = longitude @latitude = latitude yield self if block_given? end |
Instance Attribute Details
#desc ⇒ Boolean
Returns if descending order should be applied.
1199 1200 1201 |
# File 'lib/couchbase/search_options.rb', line 1199 def desc @desc end |
#field ⇒ String (readonly)
Returns name of the field to sort by.
1196 1197 1198 |
# File 'lib/couchbase/search_options.rb', line 1196 def field @field end |
#latitude ⇒ Float (readonly)
1205 1206 1207 |
# File 'lib/couchbase/search_options.rb', line 1205 def latitude @latitude end |
#longitude ⇒ Float (readonly)
1202 1203 1204 |
# File 'lib/couchbase/search_options.rb', line 1202 def longitude @longitude end |
#unit ⇒ :meters, ...
1208 1209 1210 |
# File 'lib/couchbase/search_options.rb', line 1208 def unit @unit end |
Instance Method Details
#to_json(*args) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
1223 1224 1225 |
# File 'lib/couchbase/search_options.rb', line 1223 def to_json(*args) {by: :geo_distance, field: field, desc: desc, location: [longitude, latitude], unit: unit}.to_json(*args) end |