Class: Couchbase::SearchQuery::PrefixQuery

Inherits:
Couchbase::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::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(prefix) {|self| ... } ⇒ PrefixQuery

Returns a new instance of PrefixQuery.

Parameters:

  • prefix (String)

Yield Parameters:



946
947
948
949
950
# File 'lib/couchbase/search_options.rb', line 946

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

Instance Attribute Details

#boostFloat

Returns:

  • (Float)


935
936
937
# File 'lib/couchbase/search_options.rb', line 935

def boost
  @boost
end

#fieldString

Returns:

  • (String)


941
942
943
# File 'lib/couchbase/search_options.rb', line 941

def field
  @field
end

#operatornil, ...

Returns:

  • (nil, :or, :and)


938
939
940
# File 'lib/couchbase/search_options.rb', line 938

def operator
  @operator
end

Instance Method Details

#to_hHash<Symbol, #to_json>

Returns:



953
954
955
956
957
958
# File 'lib/couchbase/search_options.rb', line 953

def to_h
  data = {:prefix => @prefix}
  data[:boost] = boost if boost
  data[:field] = field if field
  data
end