Class: Couchbase::Cluster::SearchOptions
- Inherits:
-
Object
- Object
- Couchbase::Cluster::SearchOptions
- Defined in:
- lib/couchbase/search_options.rb
Instance Attribute Summary collapse
-
#explain ⇒ Boolean
Triggers inclusion of additional search result score explanations.
-
#facets ⇒ Hash<String => SearchFacet>
Facets allow to aggregate information collected on a particular result set.
-
#fields ⇒ Array<String>
List of field values which should be retrieved for result documents, provided they were stored while indexing.
-
#highlight_fields ⇒ Array<String>
List of the fields to highlight.
-
#highlight_style ⇒ :html, :ansi
The style of highlighting in the result excerpts (if not specified, the server default will be used).
-
#limit ⇒ Integer
Limits the number of matches returned from the complete result set.
-
#scan_consistency ⇒ :not_bounded
Specifies level of consistency for the query.
-
#skip ⇒ Integer
Indicates how many matches are skipped on the result set before starting to return the matches.
-
#sort ⇒ Array<String, SearchSort>
Ordering rules to apply to the results.
-
#timeout ⇒ Integer
Timeout in milliseconds.
-
#transcoder ⇒ JsonTranscoder
Transcoder to use for the results.
Instance Method Summary collapse
-
#consistent_with(mutation_state) ⇒ void
Sets the mutation tokens this query should be consistent with.
-
#initialize {|self| ... } ⇒ SearchOptions
constructor
A new instance of SearchOptions.
Constructor Details
#initialize {|self| ... } ⇒ SearchOptions
Returns a new instance of SearchOptions.
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
#explain ⇒ Boolean
Returns 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 |
#facets ⇒ Hash<String => SearchFacet>
Facets allow to aggregate information collected on a particular result set
1214 1215 1216 |
# File 'lib/couchbase/search_options.rb', line 1214 def facets @facets end |
#fields ⇒ Array<String>
Returns 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_fields ⇒ Array<String>
Returns 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).
1159 1160 1161 |
# File 'lib/couchbase/search_options.rb', line 1159 def highlight_style @highlight_style end |
#limit ⇒ Integer
Returns 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.
1168 1169 1170 |
# File 'lib/couchbase/search_options.rb', line 1168 def scan_consistency @scan_consistency end |
#skip ⇒ Integer
Returns 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 |
#sort ⇒ Array<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”.
1209 1210 1211 |
# File 'lib/couchbase/search_options.rb', line 1209 def sort @sort end |
#timeout ⇒ Integer
Returns Timeout in milliseconds.
1147 1148 1149 |
# File 'lib/couchbase/search_options.rb', line 1147 def timeout @timeout end |
#transcoder ⇒ JsonTranscoder
Returns transcoder to use for the results.
1217 1218 1219 |
# File 'lib/couchbase/search_options.rb', line 1217 def transcoder @transcoder end |
Instance Method Details
#consistent_with(mutation_state) ⇒ void
overrides consistency level set by #scan_consistency=
This method returns an undefined value.
Sets the mutation tokens this query should be consistent with
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 |