feat(index): expose layered RaBitQ defaults across SDKs

This commit is contained in:
Yang Cen
2026-10-21 19:29:42 +08:00
parent 1480a9ff57
commit 691a222f1e
14 changed files with 240 additions and 83 deletions
+32 -8
View File
@@ -1697,14 +1697,38 @@ describe("When creating an index", () => {
});
});
it("should be able to create IVF_RQ", async () => {
await tbl.createIndex("vec", {
config: Index.ivfRq({
numPartitions: 10,
numBits: 1,
}),
});
});
test.each([
[1, true],
[2, true],
[5, undefined],
[5, false],
[5, true],
] as const)(
"should create IVF_RQ with bits=%s layered=%s",
async (numBits, layered) => {
await tbl.createIndex("vec", {
config: Index.ivfRq({ numPartitions: 10, numBits, layered }),
});
const indices = await tbl.listIndices();
expect(indices).toHaveLength(1);
expect(indices[0].indexType).toBe("IvfRq");
const expected = await tbl
.vectorSearch(queryVec)
.bypassVectorIndex()
.limit(10)
.toArray();
const actual = await tbl
.vectorSearch(queryVec)
.nprobes(10)
.refineFactor(30)
.limit(10)
.toArray();
const ids = new Set(expected.map((row) => row.id));
expect(
actual.filter((row) => ids.has(row.id)).length,
).toBeGreaterThanOrEqual(5);
},
);
it("should allow me to replace (or not) an existing index", async () => {
await tbl.createIndex("id");