Class: Couchbase::SearchSort::SearchSortField

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Couchbase::SearchSort

field, geo_distance, id, score

Constructor Details

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

Returns a new instance of SearchSortField.

Parameters:

  • field (String)

    the name of the filed for ordering

Yield Parameters:



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

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

Instance Attribute Details

#descBoolean

Returns if descending order should be applied.

Returns:

  • (Boolean)

    if descending order should be applied



1197
1198
1199
# File 'lib/couchbase/search_options.rb', line 1197

def desc
  @desc
end

#fieldString (readonly)

Returns name of the field to sort by.

Returns:

  • (String)

    name of the field to sort by



1194
1195
1196
# File 'lib/couchbase/search_options.rb', line 1194

def field
  @field
end

#missing:first, :last

Returns where the documents with missing field should be placed.

Returns:

  • (:first, :last)

    where the documents with missing field should be placed



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

def missing
  @missing
end

#mode:default, ...

Returns:

  • (:default, :min, :max)


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

def mode
  @mode
end

#type:auto, ...

Returns:

  • (:auto, :string, :number, :date)


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

def type
  @type
end

Instance Method Details

#to_json(*args) ⇒ 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.



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

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