Class: Couchbase::Cluster::SearchQuery::MatchQuery

Inherits:
Couchbase::Cluster::SearchQuery show all
Defined in:
lib/couchbase/search_options.rb,
/Users/sergey.auseyau/code/couchbase-ruby-client/lib/couchbase/search_options.rb
more...

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

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(match) {|self| ... } ⇒ MatchQuery

Returns a new instance of MatchQuery.

Parameters:

  • match (String)

Yield Parameters:

[View source]

60
61
62
63
64
# File 'lib/couchbase/search_options.rb', line 60

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

Instance Attribute Details

#analyzerString

Returns:

  • (String)

47
48
49
# File 'lib/couchbase/search_options.rb', line 47

def analyzer
  @analyzer
end

#boostFloat

Returns:

  • (Float)

41
42
43
# File 'lib/couchbase/search_options.rb', line 41

def boost
  @boost
end

#fieldString

Returns:

  • (String)

44
45
46
# File 'lib/couchbase/search_options.rb', line 44

def field
  @field
end

#fuzzinessInteger

Returns:

  • (Integer)

53
54
55
# File 'lib/couchbase/search_options.rb', line 53

def fuzziness
  @fuzziness
end

#operatornil, ...

Returns:

  • (nil, :or, :and)

56
57
58
# File 'lib/couchbase/search_options.rb', line 56

def operator
  @operator
end

#prefix_lengthInteger

Returns:

  • (Integer)

50
51
52
# File 'lib/couchbase/search_options.rb', line 50

def prefix_length
  @prefix_length
end

Instance Method Details

#to_hHash<Symbol, #to_json>

Returns:

[View source]

67
68
69
70
71
72
73
74
75
76
# File 'lib/couchbase/search_options.rb', line 67

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