Class: Couchbase::SearchQuery::PhraseQuery

Inherits:
SearchQuery
  • Object
show all
Defined in:
lib/couchbase/search_options.rb,
/home/runner/work/couchbase-ruby-client/couchbase-ruby-client/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

Constructor Details

#initialize(*terms) {|self| ... } ⇒ PhraseQuery

Returns a new instance of PhraseQuery.

Parameters:

  • terms (*String)

Yield Parameters:



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

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

Instance Attribute Details

#boost ⇒ Float

Returns:

  • (Float)


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

def boost
  @boost
end

#field ⇒ String

Returns:

  • (String)


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

def field
  @field
end

Instance Method Details

#to_h ⇒ Hash<Symbol, #to_json>

Returns:



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

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