public class SearchOptions extends CommonOptions<SearchOptions>
Modifier and Type | Class and Description |
---|---|
class |
SearchOptions.Built |
CommonOptions.BuiltCommonOptions
Modifier and Type | Method and Description |
---|---|
SearchOptions.Built |
build() |
SearchOptions |
consistentWith(MutationState consistentWith)
Sets mutation tokens this query should be consistent with.
|
SearchOptions |
explain(boolean explain)
Activates or deactivates the explanation of each result hit in the response, according to the parameter.
|
SearchOptions |
facets(Map<String,SearchFacet> facets)
Adds one
SearchFacet to the query. |
SearchOptions |
fields(String... fields)
Configures the list of fields for which the whole value should be included in the response.
|
SearchOptions |
highlight()
Configures the highlighting of matches in the response for all fields, using the server's default highlighting
style.
|
SearchOptions |
highlight(HighlightStyle style,
String... fields)
Configures the highlighting of matches in the response.
|
SearchOptions |
highlight(String... fields)
Configures the highlighting of matches in the response, for the specified fields and using the server's default
highlighting style.
|
SearchOptions |
limit(int limit)
Add a limit to the query on the number of rows it can return.
|
SearchOptions |
raw(String key,
Object value)
Allows providing custom JSON key/value pairs for advanced usage.
|
SearchOptions |
scanConsistency(SearchScanConsistency consistency)
Sets the unparameterized consistency to consider for this FTS query.
|
static SearchOptions |
searchOptions() |
SearchOptions |
serializer(JsonSerializer serializer) |
SearchOptions |
skip(int skip)
Set the number of rows to skip (eg.
|
SearchOptions |
sort(Object... sort)
Configures the list of fields (including special fields) which are used for sorting purposes.
|
clientContext, parentSpan, retryStrategy, self, timeout
public static SearchOptions searchOptions()
public SearchOptions raw(String key, Object value)
If available, it is recommended to use the methods on this object to customize the search query. This method should only be used if no such setter can be found (i.e. if an undocumented property should be set or you are using an older client and a new server-configuration property has been added to the cluster).
Note that the value will be passed through a JSON encoder, so do not provide already encoded JSON as the value. If
you want to pass objects or arrays, you can use JsonObject
and JsonArray
respectively.
key
- the parameter name (key of the JSON property) or empty.value
- the parameter value (value of the JSON property).QueryOptions
for chaining purposes.public SearchOptions limit(int limit)
limit
- the maximum number of rows to return.public SearchOptions skip(int skip)
skip
- the number of results to skip.public SearchOptions explain(boolean explain)
explain
- should the response include an explanation of each hit (true) or not (false)?public SearchOptions highlight(HighlightStyle style, String... fields)
fragments
in each hit
.
Note that to be highlighted, the fields must be stored in the FTS index.style
- the HighlightStyle
to apply.fields
- the optional fields on which to highlight. If none, all fields where there is a match are highlighted.public SearchOptions highlight(String... fields)
fragments
in each hit
.
Note that to be highlighted, the fields must be stored in the FTS index.fields
- the optional fields on which to highlight. If none, all fields where there is a match are highlighted.public SearchOptions highlight()
fragments
in each hit
.
Note that to be highlighted, the fields must be stored in the FTS index.public SearchOptions fields(String... fields)
hit
.
Note that to be highlighted, the fields must be stored in the FTS index.fields
- the fields to include.public SearchOptions scanConsistency(SearchScanConsistency consistency)
consistency
- the simple consistency to use.public SearchOptions consistentWith(MutationState consistentWith)
consistentWith
- the mutation state to be consistent with.QueryOptions
for chaining.public SearchOptions sort(Object... sort)
sort
- the fields that should take part in the sorting.public SearchOptions facets(Map<String,SearchFacet> facets)
SearchFacet
to the query.
This is an additive operation (the given facets are added to any facet previously requested),
but if an existing facet has the same name it will be replaced.
This drives the inclusion of the facets in the SearchResult
.
Note that to be faceted, a field's value must be stored in the FTS index.facets
- the facets to add to the query.public SearchOptions serializer(JsonSerializer serializer)
@Stability.Internal public SearchOptions.Built build()
Copyright © 2020 Couchbase, Inc.. All rights reserved.