Class: Couchbase::SearchQuery::MatchQuery

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 match query analyzes the input text and uses that analyzed text to query the index.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(match) {|self| ... } ⇒ MatchQuery

Returns a new instance of MatchQuery.

Parameters:

  • match (String)

Yield Parameters:



119
120
121
122
123
# File 'lib/couchbase/search_options.rb', line 119

def initialize(match)
  super()
  @match = match
  yield self if block_given?
end

Instance Attribute Details

#analyzer ⇒ String

Returns:

  • (String)


106
107
108
# File 'lib/couchbase/search_options.rb', line 106

def analyzer
  @analyzer
end

#boost ⇒ Float

Returns:

  • (Float)


100
101
102
# File 'lib/couchbase/search_options.rb', line 100

def boost
  @boost
end

#field ⇒ String

Returns:

  • (String)


103
104
105
# File 'lib/couchbase/search_options.rb', line 103

def field
  @field
end

#fuzziness ⇒ Integer

Returns:

  • (Integer)


112
113
114
# File 'lib/couchbase/search_options.rb', line 112

def fuzziness
  @fuzziness
end

#operator ⇒ nil, ...

Returns:

  • (nil, :or, :and)


115
116
117
# File 'lib/couchbase/search_options.rb', line 115

def operator
  @operator
end

#prefix_length ⇒ Integer

Returns:

  • (Integer)


109
110
111
# File 'lib/couchbase/search_options.rb', line 109

def prefix_length
  @prefix_length
end

Instance Method Details

#to_h ⇒ Hash<Symbol, #to_json>

Returns:



126
127
128
129
130
131
132
133
134
135
# File 'lib/couchbase/search_options.rb', line 126

def to_h
  data = {:match => @match}
  data[:boost] = boost if boost
  data[:field] = field if field
  data[:analyzer] = analyzer if analyzer
  data[:operator] = operator if operator
  data[:fuzziness] = fuzziness if fuzziness
  data[:prefix_length] = prefix_length if prefix_length
  data
end