Skip to content

Commit 675cdd4

Browse files
committed
rename max_edges to max_neighbors
1 parent ea1bb70 commit 675cdd4

File tree

4 files changed

+14
-14
lines changed

4 files changed

+14
-14
lines changed

libsql-sqlite3/src/vectorIndex.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,13 @@ struct VectorParamName {
389389
};
390390

391391
static struct VectorParamName VECTOR_PARAM_NAMES[] = {
392-
{ "type", VECTOR_INDEX_TYPE_PARAM_ID, 0, "diskann", VECTOR_INDEX_TYPE_DISKANN },
393-
{ "metric", VECTOR_METRIC_TYPE_PARAM_ID, 0, "cosine", VECTOR_METRIC_TYPE_COS },
394-
{ "metric", VECTOR_METRIC_TYPE_PARAM_ID, 0, "l2", VECTOR_METRIC_TYPE_L2 },
395-
{ "alpha", VECTOR_PRUNING_ALPHA_PARAM_ID, 2, 0, 0 },
396-
{ "search_l", VECTOR_SEARCH_L_PARAM_ID, 1, 0, 0 },
397-
{ "insert_l", VECTOR_INSERT_L_PARAM_ID, 1, 0, 0 },
398-
{ "max_edges", VECTOR_MAX_EDGES_PARAM_ID, 1, 0, 0 },
392+
{ "type", VECTOR_INDEX_TYPE_PARAM_ID, 0, "diskann", VECTOR_INDEX_TYPE_DISKANN },
393+
{ "metric", VECTOR_METRIC_TYPE_PARAM_ID, 0, "cosine", VECTOR_METRIC_TYPE_COS },
394+
{ "metric", VECTOR_METRIC_TYPE_PARAM_ID, 0, "l2", VECTOR_METRIC_TYPE_L2 },
395+
{ "alpha", VECTOR_PRUNING_ALPHA_PARAM_ID, 2, 0, 0 },
396+
{ "search_l", VECTOR_SEARCH_L_PARAM_ID, 1, 0, 0 },
397+
{ "insert_l", VECTOR_INSERT_L_PARAM_ID, 1, 0, 0 },
398+
{ "max_neighbors", VECTOR_MAX_NEIGHBORS_PARAM_ID, 1, 0, 0 },
399399
};
400400

401401
static int parseVectorIdxParam(const char *zParam, VectorIdxParams *pParams, const char **pErrMsg) {

libsql-sqlite3/src/vectorIndexInt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ typedef u8 MetricType;
130130
#define VECTOR_SEARCH_L_PARAM_ID 9
131131
#define VECTOR_SEARCH_L_DEFAULT 200
132132

133-
#define VECTOR_MAX_EDGES_PARAM_ID 10
133+
#define VECTOR_MAX_NEIGHBORS_PARAM_ID 10
134134

135135
/* total amount of vector index parameters */
136136
#define VECTOR_PARAM_IDS_COUNT 9

libsql-sqlite3/src/vectordiskann.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ int diskAnnCreateIndex(
434434
){
435435
int rc;
436436
int type, dims;
437-
u64 maxEdgesParam, blockSizeBytes;
437+
u64 maxNeighborsParam, blockSizeBytes;
438438
char *zSql;
439439
char columnSqlDefs[DISKANN_SQL_RENDER_LIMIT]; // definition of columns (e.g. index_key INTEGER BINARY, index_key1 TEXT, ...)
440440
char columnSqlNames[DISKANN_SQL_RENDER_LIMIT]; // just column names (e.g. index_key, index_key1, index_key2, ...)
@@ -457,13 +457,13 @@ int diskAnnCreateIndex(
457457
}
458458
assert( 0 < dims && dims <= MAX_VECTOR_SZ );
459459

460-
maxEdgesParam = vectorIdxParamsGetU64(pParams, VECTOR_MAX_EDGES_PARAM_ID);
461-
if( maxEdgesParam == 0 ){
460+
maxNeighborsParam = vectorIdxParamsGetU64(pParams, VECTOR_MAX_NEIGHBORS_PARAM_ID);
461+
if( maxNeighborsParam == 0 ){
462462
// 3 D**(1/2) gives good recall values (90%+)
463463
// we also want to keep disk overhead at moderate level - 50x of the disk size increase is the current upper bound
464-
maxEdgesParam = MIN(3 * ((int)(sqrt(dims)) + 1), (50 * nodeOverhead(vectorDataSize(type, dims))) / nodeEdgeOverhead(vectorDataSize(type, dims)) + 1);
464+
maxNeighborsParam = MIN(3 * ((int)(sqrt(dims)) + 1), (50 * nodeOverhead(vectorDataSize(type, dims))) / nodeEdgeOverhead(vectorDataSize(type, dims)) + 1);
465465
}
466-
blockSizeBytes = nodeOverhead(vectorDataSize(type, dims)) + maxEdgesParam * (u64)nodeEdgeOverhead(vectorDataSize(type, dims));
466+
blockSizeBytes = nodeOverhead(vectorDataSize(type, dims)) + maxNeighborsParam * (u64)nodeEdgeOverhead(vectorDataSize(type, dims));
467467
if( blockSizeBytes > DISKANN_MAX_BLOCK_SZ ){
468468
return SQLITE_ERROR;
469469
}

libsql-sqlite3/test/libsql_vector_index.test

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ do_execsql_test vector-transaction {
252252

253253
do_execsql_test vector-all-params {
254254
CREATE TABLE t_all_params ( emb FLOAT32(2) );
255-
CREATE INDEX t_all_params_idx ON t_all_params(libsql_vector_idx(emb, 'type=diskann', 'metric=cos', 'alpha=1.2', 'search_l=200', 'insert_l=70', 'max_edges=6'));
255+
CREATE INDEX t_all_params_idx ON t_all_params(libsql_vector_idx(emb, 'type=diskann', 'metric=cos', 'alpha=1.2', 'search_l=200', 'insert_l=70', 'max_neighbors=6'));
256256
INSERT INTO t_all_params VALUES (vector('[1,2]')), (vector('[3,4]'));
257257
SELECT * FROM vector_top_k('t_all_params_idx', vector('[1,2]'), 2);
258258
} {1 2}

0 commit comments

Comments
 (0)