mirror of https://mirror.osredm.com/root/redis.git
VINFO: use a single field for random projection info.
This commit is contained in:
parent
8f479b22b9
commit
aa92b37589
20
vset.c
20
vset.c
|
@ -1268,12 +1268,8 @@ int VINFO_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
|
||||||
|
|
||||||
struct vsetObject *vset = RedisModule_ModuleTypeGetValue(key);
|
struct vsetObject *vset = RedisModule_ModuleTypeGetValue(key);
|
||||||
|
|
||||||
/* Calculate map size based on projection presence */
|
|
||||||
int map_size = 8; /* Base fields */
|
|
||||||
if (vset->proj_matrix) map_size += 2; /* Additional fields for projection */
|
|
||||||
|
|
||||||
/* Reply with hash */
|
/* Reply with hash */
|
||||||
RedisModule_ReplyWithMap(ctx, map_size);
|
RedisModule_ReplyWithMap(ctx, 9);
|
||||||
|
|
||||||
/* Quantization type */
|
/* Quantization type */
|
||||||
RedisModule_ReplyWithSimpleString(ctx, "quant-type");
|
RedisModule_ReplyWithSimpleString(ctx, "quant-type");
|
||||||
|
@ -1287,16 +1283,10 @@ int VINFO_RedisCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
|
||||||
RedisModule_ReplyWithSimpleString(ctx, "vector-dim");
|
RedisModule_ReplyWithSimpleString(ctx, "vector-dim");
|
||||||
RedisModule_ReplyWithLongLong(ctx, vset->hnsw->vector_dim);
|
RedisModule_ReplyWithLongLong(ctx, vset->hnsw->vector_dim);
|
||||||
|
|
||||||
/* Add projection information if present */
|
/* Original input dimension before projection.
|
||||||
if (vset->proj_matrix) {
|
* This is zero for vector sets without a random projection matrix. */
|
||||||
/* Original input dimension before projection */
|
RedisModule_ReplyWithSimpleString(ctx, "projection-input-dim");
|
||||||
RedisModule_ReplyWithSimpleString(ctx, "projection-input-dim");
|
RedisModule_ReplyWithLongLong(ctx, vset->proj_input_size);
|
||||||
RedisModule_ReplyWithLongLong(ctx, vset->proj_input_size);
|
|
||||||
|
|
||||||
/* Projection enabled flag */
|
|
||||||
RedisModule_ReplyWithSimpleString(ctx, "projection-enabled");
|
|
||||||
RedisModule_ReplyWithBool(ctx, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Number of elements. */
|
/* Number of elements. */
|
||||||
RedisModule_ReplyWithSimpleString(ctx, "size");
|
RedisModule_ReplyWithSimpleString(ctx, "size");
|
||||||
|
|
Loading…
Reference in New Issue