Class: Couchbase::Cluster::SearchQuery::PrefixQuery

Inherits:
Couchbase::Cluster::SearchQuery show all
Defined in:
lib/couchbase/search_options.rb

Overview

The prefix query finds documents containing terms that start with the provided prefix. Usual better alternative is `MatchQuery`.

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, match, match_all, match_none, match_phrase, numeric_range, phrase, prefix, query_string, regexp, term, term_range, wildcard

Constructor Details

#initialize(prefix) {|self| ... } ⇒ PrefixQuery

Returns a new instance of PrefixQuery.

Parameters:

  • prefix (String)

Yield Parameters:

[View source]

818
819
820
821
822
# File 'lib/couchbase/search_options.rb', line 818

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

Instance Attribute Details

#boostFloat

Returns:

  • (Float)

810
811
812
# File 'lib/couchbase/search_options.rb', line 810

def boost
  @boost
end

#fieldString

Returns:

  • (String)

813
814
815
# File 'lib/couchbase/search_options.rb', line 813

def field
  @field
end

Instance Method Details

#to_json(*args) ⇒ String

Returns:

  • (String)
[View source]

825
826
827
828
829
830
# File 'lib/couchbase/search_options.rb', line 825

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