Couchbase Lite C
Couchbase Lite C API
Data Fields
CBLVectorIndexConfiguration Struct Reference

ENTERPRISE EDITION ONLY. More...

#include <cbl/CBLQueryIndexTypes.h>

Data Fields

CBLQueryLanguage expressionLanguage
 The language used in the expressions (Required). More...
 
FLString expression
 The expression could be specified in a JSON Array or in N1QL syntax depending on the expressionLanguage. More...
 
unsigned dimensions
 The number of vector dimensions. More...
 
unsigned centroids
 The number of centroids which is the number buckets to partition the vectors in the index. More...
 
bool isLazy
 The boolean flag indicating that index is lazy or not. More...
 
CBLVectorEncodingencoding
 Vector encoding type. More...
 
CBLDistanceMetric metric
 Distance Metric type. More...
 
unsigned minTrainingSize
 The minimum number of vectors for training the index. More...
 
unsigned maxTrainingSize
 The maximum number of vectors used for training the index. More...
 
unsigned numProbes
 The number of centroids that will be scanned during a query. More...
 

Detailed Description

ENTERPRISE EDITION ONLY.

Vector Index Configuration.

Field Documentation

◆ centroids

unsigned CBLVectorIndexConfiguration::centroids

The number of centroids which is the number buckets to partition the vectors in the index.

(Required)

Note
The recommended number of centroids is the square root of the number of vectors to be indexed, and the maximum number of centroids supported is 64,000.

◆ dimensions

unsigned CBLVectorIndexConfiguration::dimensions

The number of vector dimensions.

(Required)

Note
The maximum number of vector dimensions supported is 4096.

◆ encoding

CBLVectorEncoding* CBLVectorIndexConfiguration::encoding

Vector encoding type.

The default value is 8-bits Scalar Quantizer.

◆ expression

FLString CBLVectorIndexConfiguration::expression

The expression could be specified in a JSON Array or in N1QL syntax depending on the expressionLanguage.

(Required)

For non-lazy indexes, an expression returning either a vector, which is an array of 32-bit floating-point numbers, or a Base64 string representing an array of 32-bit floating-point numbers in little-endian order.

For lazy indexex, an expression returning a value for computing a vector lazily when using CBLIndexUpdater to add or update the vector into the index.

◆ expressionLanguage

CBLQueryLanguage CBLVectorIndexConfiguration::expressionLanguage

The language used in the expressions (Required).

◆ isLazy

bool CBLVectorIndexConfiguration::isLazy

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 CBLQueryIndex object. To get a CBLQueryIndex object, call CBLCollection_GetIndex.

◆ maxTrainingSize

unsigned CBLVectorIndexConfiguration::maxTrainingSize

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.

◆ metric

CBLDistanceMetric CBLVectorIndexConfiguration::metric

Distance Metric type.

The default value is euclidean distance.

◆ minTrainingSize

unsigned CBLVectorIndexConfiguration::minTrainingSize

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.

Note
The training will occur at or before the APPROX_VECTOR_DISANCE query is executed, provided there is enough data at that time, and consequently, if training is triggered during a query, the query may take longer to return results.
If a query is executed against the index before it is trained, a full scan of the vectors will be performed. If there are insufficient vectors in the database for training, a warning message will be logged, indicating the required number of vectors.

◆ numProbes

unsigned CBLVectorIndexConfiguration::numProbes

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.


The documentation for this struct was generated from the following file: