Class: Couchbase::Cluster::SearchOptions

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|self| ... } ⇒ SearchOptions

Returns a new instance of SearchOptions.

Yield Parameters:

[View source]

1220
1221
1222
1223
1224
1225
1226
# File 'lib/couchbase/search_options.rb', line 1220

def initialize
  @explain = false
  @transcoder = JsonTranscoder.new
  @scan_consistency = nil
  @mutation_state = nil
  yield self if block_given?
end

Instance Attribute Details

#explainBoolean

Returns triggers inclusion of additional search result score explanations. (Default: false).

Returns:

  • (Boolean)

    triggers inclusion of additional search result score explanations. (Default: false)


1156
1157
1158
# File 'lib/couchbase/search_options.rb', line 1156

def explain
  @explain
end

#facetsHash<String => SearchFacet>

Facets allow to aggregate information collected on a particular result set

Returns:


1214
1215
1216
# File 'lib/couchbase/search_options.rb', line 1214

def facets
  @facets
end

#fieldsArray<String>

Returns list of field values which should be retrieved for result documents, provided they were stored while indexing.

Returns:

  • (Array<String>)

    list of field values which should be retrieved for result documents, provided they were stored while indexing


1165
1166
1167
# File 'lib/couchbase/search_options.rb', line 1165

def fields
  @fields
end

#highlight_fieldsArray<String>

Returns list of the fields to highlight.

Returns:

  • (Array<String>)

    list of the fields to highlight


1162
1163
1164
# File 'lib/couchbase/search_options.rb', line 1162

def highlight_fields
  @highlight_fields
end

#highlight_style:html, :ansi

Returns the style of highlighting in the result excerpts (if not specified, the server default will be used).

Returns:

  • (:html, :ansi)

    the style of highlighting in the result excerpts (if not specified, the server default will be used)


1159
1160
1161
# File 'lib/couchbase/search_options.rb', line 1159

def highlight_style
  @highlight_style
end

#limitInteger

Returns limits the number of matches returned from the complete result set.

Returns:

  • (Integer)

    limits the number of matches returned from the complete result set.


1150
1151
1152
# File 'lib/couchbase/search_options.rb', line 1150

def limit
  @limit
end

#scan_consistency:not_bounded

Returns specifies level of consistency for the query.

Returns:

  • (:not_bounded)

    specifies level of consistency for the query


1168
1169
1170
# File 'lib/couchbase/search_options.rb', line 1168

def scan_consistency
  @scan_consistency
end

#skipInteger

Returns indicates how many matches are skipped on the result set before starting to return the matches.

Returns:

  • (Integer)

    indicates how many matches are skipped on the result set before starting to return the matches


1153
1154
1155
# File 'lib/couchbase/search_options.rb', line 1153

def skip
  @skip
end

#sortArray<String, SearchSort>

Ordering rules to apply to the results

The list might contain either strings or special objects, that derive from Couchbase::Cluster::SearchSort.

In case of String, the value represents the name of the field with optional - in front of the name, which will turn on descending mode for this field. One field is special is “_score” which will sort results by their score.

When nothing specified, the Server will order results by their score descending, which is equivalent of “-_score”.

Returns:

  • (Array<String, SearchSort>)

    list of ordering object


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

def sort
  @sort
end

#timeoutInteger

Returns Timeout in milliseconds.

Returns:

  • (Integer)

    Timeout in milliseconds


1147
1148
1149
# File 'lib/couchbase/search_options.rb', line 1147

def timeout
  @timeout
end

#transcoderJsonTranscoder

Returns transcoder to use for the results.

Returns:


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

def transcoder
  @transcoder
end

Instance Method Details

#consistent_with(mutation_state) ⇒ void

Note:

overrides consistency level set by #scan_consistency=

This method returns an undefined value.

Sets the mutation tokens this query should be consistent with

Parameters:

  • mutation_state (MutationState)

    the mutation state containing the mutation tokens

[View source]

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

def consistent_with(mutation_state)
  @scan_consistency = nil if @scan_consistency
  @mutation_state = mutation_state
end