Couchbase C++ SDK
1.4.0 (rev. 59aa900)
Toggle main menu visibility
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
20
#include <
couchbase/vector_query.hxx
>
21
#include <
couchbase/vector_search_options.hxx
>
22
23
namespace
couchbase
24
{
31
class
vector_search
32
{
33
public
:
43
explicit
vector_search
(std::vector<vector_query> vector_queries,
44
vector_search_options
options
= {})
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
61
explicit
vector_search
(
vector_query
query
)
62
: vector_queries_{ std::vector<
vector_query
>{ std::move(
query
) } }
63
{
64
}
65
72
[[nodiscard]]
vector_search_options::built
options
()
const
73
{
74
return
options_;
75
}
76
83
[[nodiscard]]
auto
encode
() const -> encoded_search_query;
84
85
private:
86
std::vector<
vector_query
> vector_queries_;
87
vector_search_options
::built options_{};
88
};
89
}
// namespace couchbase
couchbase::vector_query
Definition
vector_query.hxx:33
couchbase::vector_search::vector_search
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
couchbase::vector_search::encode
auto encode() const -> encoded_search_query
couchbase::vector_search::options
vector_search_options::built options() const
Fetches the vector_search_options.
Definition
vector_search.hxx:72
couchbase::vector_search::vector_search
vector_search(vector_query query)
Will execute a single vector_query, using default options.
Definition
vector_search.hxx:61
couchbase
Represents a single item from the result of scan().
Definition
allow_querying_search_index_options.hxx:28
couchbase::service_type::query
@ query
The Query service (SQL++).
Definition
service_type.hxx:31
couchbase::vector_search_options::built
Immutable value object representing consistent options.
Definition
vector_search_options.hxx:41
couchbase::vector_search_options
Options related to executing a vector_search.
Definition
vector_search_options.hxx:33
vector_query.hxx
vector_search_options.hxx
couchbase
vector_search.hxx
Generated by
1.17.0