Couchbase C++ SDK
1.4.0 (rev. 59aa900)
Toggle main menu visibility
Loading...
Searching...
No Matches
disjunction_query.hxx
Go to the documentation of this file.
1
/* -*- Mode: C++; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
2
/*
3
* Copyright 2023-Present Couchbase, Inc.
4
*
5
* Licensed under the Apache License, Version 2.0 (the "License");
6
* you may not use this file except in compliance with the License.
7
* You may obtain a copy of the License at
8
*
9
* http://www.apache.org/licenses/LICENSE-2.0
10
*
11
* Unless required by applicable law or agreed to in writing, software
12
* distributed under the License is distributed on an "AS IS" BASIS,
13
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
* See the License for the specific language governing permissions and
15
* limitations under the License.
16
*/
17
18
#pragma once
19
20
#include <
couchbase/search_query.hxx
>
21
22
#include <cstdint>
23
#include <memory>
24
#include <vector>
25
26
namespace
couchbase
27
{
46
class
disjunction_query
:
public
search_query
47
{
48
public
:
58
template
<
typename
... SearchQuery>
59
explicit
disjunction_query
(SearchQuery&&... queries)
60
{
61
or_else
(std::forward<SearchQuery>(queries)...);
62
}
63
75
template
<
typename
... SearchQuery>
76
auto
or_else
(SearchQuery... queries) ->
disjunction_query
&
77
{
78
(disjuncts_.emplace_back(std::make_shared<SearchQuery>(std::move(queries))), ...);
79
return
*
this
;
80
}
81
92
auto
min
(std::uint32_t number_of_queries) ->
disjunction_query
&
93
{
94
min_ = number_of_queries;
95
return
*
this
;
96
}
97
104
[[nodiscard]]
auto
encode
() const -> encoded_search_query override;
105
106
private:
107
std::vector<std::shared_ptr<
search_query
>> disjuncts_{};
108
std::uint32_t min_{ 1 };
109
};
110
}
// namespace couchbase
couchbase::disjunction_query::min
auto min(std::uint32_t number_of_queries) -> disjunction_query &
Set the minimum number of child queries that must be satisfied for the disjunction query.
Definition
disjunction_query.hxx:92
couchbase::disjunction_query::disjunction_query
disjunction_query(SearchQuery &&... queries)
Create a disjunction query.
Definition
disjunction_query.hxx:59
couchbase::disjunction_query::encode
auto encode() const -> encoded_search_query override
couchbase::disjunction_query::or_else
auto or_else(SearchQuery... queries) -> disjunction_query &
Add one or more queries to add to the disjunction.
Definition
disjunction_query.hxx:76
couchbase::search_query::search_query
search_query()=default
couchbase
Represents a single item from the result of scan().
Definition
allow_querying_search_index_options.hxx:28
search_query.hxx
couchbase
disjunction_query.hxx
Generated by
1.17.0