38class tao_json_serializer;
59 std::optional<std::uint32_t>
limit{};
60 std::optional<std::uint32_t>
skip{};
67 std::map<std::string, codec::binary, std::less<>>
raw{};
68 std::map<std::string, std::shared_ptr<search_facet>, std::less<>>
facets{};
69 std::vector<std::shared_ptr<search_sort>>
sort{};
122 client_context_id_.reset();
152 mutation_state_.clear();
175 mutation_state_ = state.tokens();
176 scan_consistency_.reset();
190 template<
typename Value,
192 std::enable_if_t<codec::is_serializer_v<Serializer>,
bool> =
true>
195 raw_[std::move(name)] = std::move(Serializer::template serialize<Value>(value));
257 disable_scoring_ = disable;
272 include_locations_ = include;
309 fields_ = std::move(
fields);
331 highlight_style_ = style;
332 highlight_fields_ = std::move(
fields);
354 highlight_fields_ = std::move(
fields);
380 sort_string_ = std::move(sort_expressions);
399 sort_ = std::move(sort_objects);
420 facets_[name] = std::move(
facet);
438 template<
typename... Facets>
465 facets_[std::move(name)] = std::move(
facet);
487 template<
typename Facet>
490 facets_[std::move(name)] = std::make_shared<Facet>(std::move(
facet));
495 template<
typename Name,
typename Facet,
typename... Rest>
496 void encode_facet(
const std::pair<Name, Facet>&
facet, Rest... args)
498 facets_[std::move(
facet.first)] = std::make_shared<Facet>(std::move(
facet.second));
499 if constexpr (
sizeof...(args) > 0) {
500 encode_facet(args...);
504 std::optional<std::string> client_context_id_{};
505 bool include_locations_{
false };
506 bool disable_scoring_{
false };
507 std::optional<bool> explain_{};
508 std::optional<std::uint32_t> limit_{};
509 std::optional<std::uint32_t> skip_{};
510 std::vector<std::string> collections_{};
511 std::vector<std::string> fields_{};
512 std::vector<std::string> highlight_fields_{};
513 std::optional<highlight_style> highlight_style_{};
514 std::optional<search_scan_consistency> scan_consistency_{};
515 std::vector<mutation_token> mutation_state_{};
516 std::map<std::string, codec::binary, std::less<>> raw_{};
517 std::map<std::string, std::shared_ptr<search_facet>, std::less<>> facets_{};
518 std::vector<std::shared_ptr<search_sort>> sort_{};
519 std::vector<std::string> sort_string_{};
Definition tao_json_serializer.hxx:42
Common options that used by most operations.
Definition common_options.hxx:38
auto self() -> search_options &
Definition common_options.hxx:116
auto build_common_options() const -> built
Definition common_options.hxx:103
Aggregation of one or more mutation_tokens for specifying consistency requirements of N1QL or FTS que...
Definition mutation_state.hxx:35
Represents result of cluster::search() and scope::search() calls.
Definition search_result.hxx:45
Represents a single item from the result of collection::scan()
Definition allow_querying_search_index_options.hxx:28
std::function< void(error, search_result)> search_handler
The signature for the handler of the cluster::search() and scope::search() operations.
Definition search_options.hxx:528
highlight_style
Enumeration of the highlighting styles recognized by the FTS engine.
Definition highlight_style.hxx:28
@ html
Use HTML tags <mark> and </mark> to indicate matches in the fields.
search_scan_consistency
Definition search_scan_consistency.hxx:22
Immutable value object representing consistent options.
Definition search_options.hxx:54
std::vector< std::string > highlight_fields
Definition search_options.hxx:63
std::optional< bool > explain
Definition search_options.hxx:58
std::vector< std::string > collections
Definition search_options.hxx:61
std::map< std::string, codec::binary, std::less<> > raw
Definition search_options.hxx:67
std::optional< std::string > client_context_id
Definition search_options.hxx:55
std::map< std::string, std::shared_ptr< search_facet >, std::less<> > facets
Definition search_options.hxx:68
bool include_locations
Definition search_options.hxx:56
std::optional< search_scan_consistency > scan_consistency
Definition search_options.hxx:65
std::vector< std::shared_ptr< search_sort > > sort
Definition search_options.hxx:69
std::vector< std::string > fields
Definition search_options.hxx:62
std::optional< std::uint32_t > skip
Definition search_options.hxx:60
std::optional< std::uint32_t > limit
Definition search_options.hxx:59
bool disable_scoring
Definition search_options.hxx:57
std::vector< std::string > sort_string
Definition search_options.hxx:70
Options for cluster::search() and scope::search().
Definition search_options.hxx:47
auto skip(std::uint32_t skip) -> search_options &
Set the number of rows to skip (eg.
Definition search_options.hxx:208
auto highlight(highlight_style style=highlight_style::html, std::vector< std::string > fields={}) -> search_options &
Configures the highlighting of matches in the response.
Definition search_options.hxx:328
auto fields(std::vector< std::string > fields) -> search_options &
Configures the list of fields for which the whole value should be included in the response.
Definition search_options.hxx:307
auto explain(bool explain) -> search_options &
Activates or deactivates the explanation of each result hit in the response, according to the paramet...
Definition search_options.hxx:240
auto facet(std::string name, Facet facet) -> search_options &
Adds one search_facet to the query.
Definition search_options.hxx:488
auto facet(std::string name, std::shared_ptr< search_facet > facet) -> search_options &
Adds one search_facet to the query.
Definition search_options.hxx:463
auto sort(std::vector< std::shared_ptr< search_sort > > sort_objects) -> search_options &
Configures the list of search_sort instances which are used for sorting purposes.
Definition search_options.hxx:397
auto highlight(std::vector< std::string > fields) -> search_options &
Configures the highlighting of matches in the response for all fields, using the server's default hig...
Definition search_options.hxx:351
auto consistent_with(const mutation_state &state) -> search_options &
Sets the mutation_tokens this query should be consistent with.
Definition search_options.hxx:173
auto scan_consistency(search_scan_consistency scan_consistency) -> search_options &
Customizes the consistency guarantees for this query.
Definition search_options.hxx:149
auto sort(std::vector< std::string > sort_expressions) -> search_options &
Configures the list of fields (including special fields) which are used for sorting purposes.
Definition search_options.hxx:378
auto build() const -> built
Validates options and returns them as an immutable value.
Definition search_options.hxx:84
auto facets(std::map< std::string, std::shared_ptr< search_facet > > facets) -> search_options &
Sets list of search_facet to the query.
Definition search_options.hxx:416
auto disable_scoring(bool disable) -> search_options &
If set to true, thee server will not perform any scoring on the hits.
Definition search_options.hxx:255
auto include_locations(bool include) -> search_options &
If set to true, will include the search_row::locations().
Definition search_options.hxx:270
auto limit(std::uint32_t limit) -> search_options &
Add a limit to the query on the number of rows it can return.
Definition search_options.hxx:224
auto facets(const Facets &... facets) -> search_options &
Sets list of search_facet to the query.
Definition search_options.hxx:439
auto client_context_id(std::string client_context_id) -> search_options &
Supports providing a custom client context ID for this query.
Definition search_options.hxx:119
auto collections(std::vector< std::string > collections) -> search_options &
Allows to limit the search query to a specific list of collection names.
Definition search_options.hxx:287
auto raw(std::string name, const Value &value) -> search_options &
Definition search_options.hxx:193