Couchbase C++ SDK 1.0.4 (rev. 5355b0f)
Loading...
Searching...
No Matches
vector_search.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
22
23namespace couchbase
24{
32{
33public:
43 explicit vector_search(std::vector<vector_query> vector_queries,
45 : vector_queries_{ std::move(vector_queries) }
46 , options_{ options.build() }
47 {
48 if (vector_queries_.empty()) {
49 throw std::invalid_argument("At least one vector query must be specified");
50 }
51 }
52
62 : vector_queries_{ std::vector<vector_query>{ std::move(query) } }
63 {
64 }
65
73 {
74 return options_;
75 }
76
83 [[nodiscard]] auto encode() const -> encoded_search_query;
84
85private:
86 std::vector<vector_query> vector_queries_;
87 vector_search_options::built options_{};
88};
89} // namespace couchbase
Definition vector_query.hxx:29
A vector_search allows one or more vector_query to be executed.
Definition vector_search.hxx:32
vector_search(std::vector< vector_query > vector_queries, vector_search_options options={})
Will execute all of the provided vector_queries, using the specified options.
Definition vector_search.hxx:43
auto encode() const -> encoded_search_query
vector_search_options::built options() const
Fetches the vector_search_options.
Definition vector_search.hxx:72
vector_search(vector_query query)
Will execute a single vector_query, using default options.
Definition vector_search.hxx:61
Represents a single item from the result of collection::scan()
Definition allow_querying_search_index_options.hxx:28
@ query
The Query service (SQL++)
Immutable value object representing consistent options.
Definition vector_search_options.hxx:41
Options related to executing a vector_search.
Definition vector_search_options.hxx:33