|
Couchbase Lite C++
Couchbase Lite C++ API
|
Configuration for creating a vector index, which enables searching documents by vector similarity. More...
#include <cbl++/VectorIndex.hh>
Public Member Functions | |
| VectorIndexConfiguration (CBLQueryLanguage expressionLanguage, std::string_view expression, unsigned dimensions, unsigned centroids) | |
| Creates the VectorIndexConfiguration. | |
| QueryLanguage | expressionLanguage () const |
| The language used in the expressions. | |
| slice | expression () const |
| The expression. | |
| unsigned | dimensions () const |
| The number of vector dimensions. | |
| unsigned | centroids () const |
| The number of centroids. | |
Public Attributes | |
| bool | isLazy = false |
| The boolean flag indicating that index is lazy or not. | |
| VectorEncoding | encoding = VectorEncoding::scalarQuantizer(kCBLSQ8) |
| Vector encoding type. | |
| DistanceMetric | metric = kCBLDistanceMetricEuclideanSquared |
| Distance Metric type. | |
| unsigned | minTrainingSize = 0 |
| The minimum number of vectors for training the index. | |
| unsigned | maxTrainingSize = 0 |
| The maximum number of vectors used for training the index. | |
| unsigned | numProbes = 0 |
| The number of centroids that will be scanned during a query. | |
Protected Attributes | |
| friend | Collection |
Configuration for creating a vector index, which enables searching documents by vector similarity.
|
inline |
Creates the VectorIndexConfiguration.
| expressionLanguage | The language used in the expressions. |
| expression | The expression could be specified in a JSON Array or in N1QL syntax depending on the expressionLanguage.
|
| dimensions | The number of vector dimensions. |
| centroids | The number of centroids which is the number buckets to partition the vectors in the index. |
|
inline |
The number of centroids.
|
inline |
The number of vector dimensions.
|
inline |
The expression.
|
inline |
The language used in the expressions.
|
protected |
| VectorEncoding cbl::VectorIndexConfiguration::encoding = VectorEncoding::scalarQuantizer(kCBLSQ8) |
Vector encoding type.
The default value is 8-bits Scalar Quantizer.
| bool cbl::VectorIndexConfiguration::isLazy = false |
The boolean flag indicating that index is lazy or not.
The default value is false.
If the index is lazy, it will not be automatically updated when the documents in the collection are changed, except when the documents are deleted or purged.
When configuring the index to be lazy, the expression set to the config is the expression that returns a value used for computing the vector.
To update the lazy index, use a CBLIndexUpdater object, which can be obtained from a QueryIndex object. To get a QueryIndex object, call Collection::getIndex.
| unsigned cbl::VectorIndexConfiguration::maxTrainingSize = 0 |
The maximum number of vectors used for training the index.
The default value is zero, meaning that the maxTrainingSize will be determined based on the number of centroids, encoding types, and encoding parameters.
| DistanceMetric cbl::VectorIndexConfiguration::metric = kCBLDistanceMetricEuclideanSquared |
Distance Metric type.
The default value is squared euclidean distance.
| unsigned cbl::VectorIndexConfiguration::minTrainingSize = 0 |
The minimum number of vectors for training the index.
The default value is zero, meaning that minTrainingSize will be determined based on the number of centroids, encoding types, and the encoding parameters.
| unsigned cbl::VectorIndexConfiguration::numProbes = 0 |
The number of centroids that will be scanned during a query.
The default value is zero, meaning that the numProbes will be determined based on the number of centroids.