20#ifdef COUCHBASE_ENTERPRISE
25#include "cbl/CBLQueryIndexTypes.h"
71 _ref = std::shared_ptr<CBLVectorEncoding>(
ref, [](
auto r) {
76 std::shared_ptr<CBLVectorEncoding> _ref;
169 template <
typename F>
170 decltype(
auto) withCConfig(F&& f)
const {
172 _exprLang,
slice(_expr), _dimensions, _centroids
180 return std::forward<F>(f)(cConfig);
185 unsigned _dimensions;
#define CBL_ASSUME_NONNULL_END
#define CBL_ASSUME_NONNULL_BEGIN
CBLCollection *_Nullable ref() const
Returns a pointer to the underlying C object (CBLCollection), or NULL if this is a null reference.
Definition Collection.hh:373
std::string name() const
The collection's name.
Definition Collection.hh:136
void createVectorIndex(std::string_view name, VectorIndexConfiguration config)
Creates a vector index in the collection.
Definition VectorIndex.hh:189
Vector encoding type to use in a VectorIndexConfiguration, for reducing the size of the stored vector...
Definition VectorIndex.hh:37
friend class VectorIndexConfiguration
Definition VectorIndex.hh:65
VectorEncoding()=delete
Deleted: a VectorEncoding must be constructed via one of the named factories (none,...
CBLVectorEncoding * ref() const
Definition VectorIndex.hh:67
static VectorEncoding scalarQuantizer(CBLScalarQuantizerType type)
Creates a Scalar Quantizer encoding type to use in VectorIndexConfiguration.
Definition VectorIndex.hh:48
static VectorEncoding productQuantizer(unsigned int subquantizers, unsigned int bits)
Creates a Product Quantizer encoding type to use in VectorIndexConfiguration.
Definition VectorIndex.hh:56
static VectorEncoding none()
Creates a no-encoding type to use in VectorIndexConfiguration; 4 bytes per dimension,...
Definition VectorIndex.hh:41
Configuration for creating a vector index, which enables searching documents by vector similarity.
Definition VectorIndex.hh:82
unsigned centroids() const
The number of centroids.
Definition VectorIndex.hh:118
VectorIndexConfiguration(CBLQueryLanguage expressionLanguage, std::string_view expression, unsigned dimensions, unsigned centroids)
Creates the VectorIndexConfiguration.
Definition VectorIndex.hh:98
unsigned dimensions() const
The number of vector dimensions.
Definition VectorIndex.hh:115
bool isLazy
The boolean flag indicating that index is lazy or not.
Definition VectorIndex.hh:130
DistanceMetric metric
Distance Metric type.
Definition VectorIndex.hh:136
VectorEncoding encoding
Vector encoding type.
Definition VectorIndex.hh:133
QueryLanguage expressionLanguage() const
The language used in the expressions.
Definition VectorIndex.hh:109
unsigned minTrainingSize
The minimum number of vectors for training the index.
Definition VectorIndex.hh:151
slice expression() const
The expression.
Definition VectorIndex.hh:112
unsigned numProbes
The number of centroids that will be scanned during a query.
Definition VectorIndex.hh:161
unsigned maxTrainingSize
The maximum number of vectors used for training the index.
Definition VectorIndex.hh:156
friend Collection
Definition VectorIndex.hh:164
bool CBLCollection_CreateVectorIndex(CBLCollection *collection, FLString name, CBLVectorIndexConfiguration config, CBLError *_cbl_nullable outError)
_cbl_warn_unused CBLVectorEncoding * CBLVectorEncoding_CreateNone(void)
void CBLVectorEncoding_Free(CBLVectorEncoding *_cbl_nullable)
struct CBLVectorEncoding CBLVectorEncoding
_cbl_warn_unused CBLVectorEncoding * CBLVectorEncoding_CreateScalarQuantizer(CBLScalarQuantizerType type)
_cbl_warn_unused CBLVectorEncoding * CBLVectorEncoding_CreateProductQuantizer(unsigned subquantizers, unsigned bits)
kCBLDistanceMetricEuclideanSquared
fleece::slice slice
Convenience alias for fleece::slice, a non-owning view of a byte range.
Definition Base.hh:49
CBLDistanceMetric DistanceMetric
The distance metric used by a vector index to measure the similarity of vectors.
Definition VectorIndex.hh:32
CBLQueryLanguage QueryLanguage
Definition Base.hh:53
CBLVectorEncoding * encoding