Class: Couchbase::Cluster::SearchQuery::GeoPolygonQuery
- Inherits:
-
Couchbase::Cluster::SearchQuery
- Object
- Couchbase::Cluster::SearchQuery
- Couchbase::Cluster::SearchQuery::GeoPolygonQuery
- Defined in:
- lib/couchbase/search_options.rb,
/Users/sergey.auseyau/code/couchbase-ruby-client/lib/couchbase/search_options.rb more...
Overview
A search query which allows to match inside a geo polygon.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(coordinates) {|self| ... } ⇒ GeoPolygonQuery
constructor
A new instance of GeoPolygonQuery.
- #to_json(*args) ⇒ String
Methods inherited from Couchbase::Cluster::SearchQuery
boolean_field, booleans, conjuncts, date_range, disjuncts, doc_id, geo_bounding_box, geo_distance, geo_polygon, match, match_all, match_none, match_phrase, numeric_range, phrase, prefix, query_string, regexp, term, term_range, wildcard
Constructor Details
#initialize(coordinates) {|self| ... } ⇒ GeoPolygonQuery
Returns a new instance of GeoPolygonQuery.
637 638 639 640 641 |
# File 'lib/couchbase/search_options.rb', line 637 def initialize(coordinates) super() @coordinates = coordinates yield self if block_given? end |
Instance Attribute Details
#boost ⇒ Float
629 630 631 |
# File 'lib/couchbase/search_options.rb', line 629 def boost @boost end |
#field ⇒ String
632 633 634 |
# File 'lib/couchbase/search_options.rb', line 632 def field @field end |
Instance Method Details
#to_json(*args) ⇒ String
644 645 646 647 648 649 650 651 |
# File 'lib/couchbase/search_options.rb', line 644 def to_json(*args) data = { "polygon_points" => @coordinates.map { |coord| [coord.longitude, coord.latitude] }, } data["boost"] = boost if boost data["field"] = field if field data.to_json(*args) end |