Class: Couchbase::SearchQuery::PhraseQuery

Inherits:
Couchbase::SearchQuery show all
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

Methods inherited from Couchbase::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(*terms) {|self| ... } ⇒ PhraseQuery

Returns a new instance of PhraseQuery.

Parameters:

  • terms (*String)

Yield Parameters:



982
983
984
985
986
# File 'lib/couchbase/search_options.rb', line 982

def initialize(*terms)
  super()
  @terms = terms.flatten
  yield self if block_given?
end

Instance Attribute Details

#boostFloat

Returns:

  • (Float)


974
975
976
# File 'lib/couchbase/search_options.rb', line 974

def boost
  @boost
end

#fieldString

Returns:

  • (String)


977
978
979
# File 'lib/couchbase/search_options.rb', line 977

def field
  @field
end

Instance Method Details

#to_hHash<Symbol, #to_json>

Returns:



989
990
991
992
993
994
# File 'lib/couchbase/search_options.rb', line 989

def to_h
  data = {:terms => @terms.flatten.uniq}
  data[:boost] = boost if boost
  data[:field] = field if field
  data
end