Class: Couchbase::Cluster::SearchQuery::TermRangeQuery
- Inherits:
-
Couchbase::Cluster::SearchQuery
- Object
- Couchbase::Cluster::SearchQuery
- Couchbase::Cluster::SearchQuery::TermRangeQuery
- Defined in:
- lib/couchbase/search_options.rb,
/Users/sergey.auseyau/code/couchbase-ruby-client/lib/couchbase/search_options.rb more...
Overview
The term range query finds documents containing a string value in the specified field within the specified range.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize {|self| ... } ⇒ TermRangeQuery
constructor
A new instance of TermRangeQuery.
-
#max(upper_bound, inclusive = nil) ⇒ Object
Sets upper bound of the range.
-
#min(lower_bound, inclusive = nil) ⇒ Object
Sets lower bound of the range.
- #to_h ⇒ Hash<Symbol, #to_json>
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, #to_json, wildcard
Constructor Details
#initialize {|self| ... } ⇒ TermRangeQuery
Returns a new instance of TermRangeQuery.
483 484 485 486 487 488 489 490 |
# File 'lib/couchbase/search_options.rb', line 483 def initialize super @min = nil @min_inclusive = nil @max = nil @max_inclusive = nil yield self if block_given? end |
Instance Attribute Details
#boost ⇒ Float
455 456 457 |
# File 'lib/couchbase/search_options.rb', line 455 def boost @boost end |
#field ⇒ String
458 459 460 |
# File 'lib/couchbase/search_options.rb', line 458 def field @field end |
Instance Method Details
#max(upper_bound, inclusive = nil) ⇒ Object
Sets upper bound of the range.
The upper boundary is considered exclusive by default on the server side.
477 478 479 480 |
# File 'lib/couchbase/search_options.rb', line 477 def max(upper_bound, inclusive = nil) @max = upper_bound @max_inclusive = inclusive end |
#min(lower_bound, inclusive = nil) ⇒ Object
Sets lower bound of the range.
The lower boundary is considered inclusive by default on the server side.
466 467 468 469 |
# File 'lib/couchbase/search_options.rb', line 466 def min(lower_bound, inclusive = nil) @min = lower_bound @min_inclusive = inclusive end |
#to_h ⇒ Hash<Symbol, #to_json>
493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 |
# File 'lib/couchbase/search_options.rb', line 493 def to_h raise ArgumentError, "either min or max must be set for TermRangeQuery" if @min.nil? && @max.nil? data = {} data[:boost] = boost if boost data[:field] = field if field if @min data[:min] = @min data[:inclusive_min] = @min_inclusive unless @min_inclusive.nil? end if @max data[:max] = @max data[:inclusive_max] = @max_inclusive unless @max_inclusive.nil? end data end |