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

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

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, wildcard

Constructor Details

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

Returns a new instance of MatchQuery.

Parameters:

  • match (String)

Yield Parameters:



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

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

Instance Attribute Details

#analyzerString

Returns:

  • (String)


37
38
39
# File 'lib/couchbase/search_options.rb', line 37

def analyzer
  @analyzer
end

#boostFloat

Returns:

  • (Float)


31
32
33
# File 'lib/couchbase/search_options.rb', line 31

def boost
  @boost
end

#fieldString

Returns:

  • (String)


34
35
36
# File 'lib/couchbase/search_options.rb', line 34

def field
  @field
end

#fuzzinessInteger

Returns:

  • (Integer)


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

def fuzziness
  @fuzziness
end

#prefix_lengthInteger

Returns:

  • (Integer)


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

def prefix_length
  @prefix_length
end

Instance Method Details

#to_json(*args) ⇒ String

Returns:

  • (String)


54
55
56
57
58
59
60
61
62
63
64
# File 'lib/couchbase/search_options.rb', line 54

def to_json(*args)
  data = {"match" => @match}
  data["boost"] = boost if boost
  data["field"] = field if field
  data["analyzer"] = analyzer if analyzer
  if fuzziness
    data["fuzziness"] = fuzziness
    data["prefix_length"] = prefix_length if prefix_length
  end
  data.to_json(*args)
end