Class: Couchbase::SearchSort::SearchSortField

Inherits:
SearchSort
  • Object
show all
Defined in:
lib/couchbase/search_options.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(field) {|| ... } ⇒ SearchSortField

Returns a new instance of SearchSortField.

Parameters:

  • the name of the filed for ordering

Yield Parameters:



1215
1216
1217
1218
1219
# File 'lib/couchbase/search_options.rb', line 1215

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

Instance Attribute Details

#desc ⇒ Boolean

Returns if descending order should be applied.

Returns:

  • if descending order should be applied



1202
1203
1204
# File 'lib/couchbase/search_options.rb', line 1202

def desc
  @desc
end

#field ⇒ String (readonly)

Returns name of the field to sort by.

Returns:

  • name of the field to sort by



1199
1200
1201
# File 'lib/couchbase/search_options.rb', line 1199

def field
  @field
end

#missing ⇒ :first, :last

Returns where the documents with missing field should be placed.

Returns:

  • where the documents with missing field should be placed



1208
1209
1210
# File 'lib/couchbase/search_options.rb', line 1208

def missing
  @missing
end

#mode ⇒ :default, ...

Returns:



1211
1212
1213
# File 'lib/couchbase/search_options.rb', line 1211

def mode
  @mode
end

#type ⇒ :auto, ...

Returns:



1205
1206
1207
# File 'lib/couchbase/search_options.rb', line 1205

def type
  @type
end

Instance Method Details

#to_json ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

API:

  • private



1222
1223
1224
# File 'lib/couchbase/search_options.rb', line 1222

def to_json(*)
  {by: :field, field: field, desc: desc, type: type, missing: missing, mode: mode}.to_json(*)
end