Class: Couchbase::Cluster::SearchQuery::PhraseQuery
- Inherits:
-
Couchbase::Cluster::SearchQuery
- Object
- Couchbase::Cluster::SearchQuery
- Couchbase::Cluster::SearchQuery::PhraseQuery
- Defined in:
- lib/couchbase/search_options.rb
Overview
A query that looks for *exact* match of several terms (in the exact order) in the index. Usual better alternative is MatchPhraseQuery.
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#initialize(*terms) {|self| ... } ⇒ PhraseQuery
constructor
A new instance of PhraseQuery.
- #to_json(*args) ⇒ String
Methods inherited from Couchbase::Cluster::SearchQuery
boolean_field, booleans, conjuncts, date_range, disjuncts, doc_id, geo_bounding_box, geo_distance, match, match_all, match_none, match_phrase, numeric_range, phrase, prefix, query_string, regexp, term, term_range, wildcard
Constructor Details
#initialize(*terms) {|self| ... } ⇒ PhraseQuery
Returns a new instance of PhraseQuery.
854 855 856 857 858 |
# File 'lib/couchbase/search_options.rb', line 854 def initialize(*terms) super() @terms = terms.flatten yield self if block_given? end |
Instance Attribute Details
#boost ⇒ Float
846 847 848 |
# File 'lib/couchbase/search_options.rb', line 846 def boost @boost end |
#field ⇒ String
849 850 851 |
# File 'lib/couchbase/search_options.rb', line 849 def field @field end |
Instance Method Details
#to_json(*args) ⇒ String
861 862 863 864 865 866 |
# File 'lib/couchbase/search_options.rb', line 861 def to_json(*args) data = {"terms" => @terms.flatten.uniq} data["boost"] = boost if boost data["field"] = field if field data.to_json(*args) end |