Skip to content

Commit 5641c84

Browse files
committed
fix: update Qdrant vector store configuration with on_disk and hnsw parameters
1 parent f72f6c2 commit 5641c84

File tree

2 files changed

+43
-13
lines changed

2 files changed

+43
-13
lines changed

src/services/code-index/vector-store/__tests__/qdrant-client.spec.ts

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,12 @@ describe("QdrantVectorStore", () => {
532532
vectors: {
533533
size: mockVectorSize,
534534
distance: "Cosine", // Assuming 'Cosine' is the DISTANCE_METRIC
535+
on_disk: true,
536+
},
537+
hnsw_config: {
538+
m: 64,
539+
ef_construct: 512,
540+
on_disk: true,
535541
},
536542
})
537543
expect(mockQdrantClientInstance.deleteCollection).not.toHaveBeenCalled()
@@ -610,6 +616,12 @@ describe("QdrantVectorStore", () => {
610616
vectors: {
611617
size: mockVectorSize, // Should use the new, correct vector size
612618
distance: "Cosine",
619+
on_disk: true,
620+
},
621+
hnsw_config: {
622+
m: 64,
623+
ef_construct: 512,
624+
on_disk: true,
613625
},
614626
})
615627

@@ -903,6 +915,12 @@ describe("QdrantVectorStore", () => {
903915
vectors: {
904916
size: newVectorSize, // Should create with new 768 dimensions
905917
distance: "Cosine",
918+
on_disk: true,
919+
},
920+
hnsw_config: {
921+
m: 64,
922+
ef_construct: 512,
923+
on_disk: true,
906924
},
907925
})
908926
expect(mockQdrantClientInstance.createPayloadIndex).toHaveBeenCalledTimes(5)
@@ -1248,7 +1266,7 @@ describe("QdrantVectorStore", () => {
12481266
score_threshold: DEFAULT_SEARCH_MIN_SCORE,
12491267
limit: DEFAULT_MAX_SEARCH_RESULTS,
12501268
params: {
1251-
hnsw_ef: 128,
1269+
hnsw_ef: 256,
12521270
exact: false,
12531271
},
12541272
with_payload: {
@@ -1299,7 +1317,7 @@ describe("QdrantVectorStore", () => {
12991317
score_threshold: DEFAULT_SEARCH_MIN_SCORE,
13001318
limit: DEFAULT_MAX_SEARCH_RESULTS,
13011319
params: {
1302-
hnsw_ef: 128,
1320+
hnsw_ef: 256,
13031321
exact: false,
13041322
},
13051323
with_payload: {
@@ -1325,7 +1343,7 @@ describe("QdrantVectorStore", () => {
13251343
score_threshold: customMinScore,
13261344
limit: DEFAULT_MAX_SEARCH_RESULTS,
13271345
params: {
1328-
hnsw_ef: 128,
1346+
hnsw_ef: 256,
13291347
exact: false,
13301348
},
13311349
with_payload: {
@@ -1349,7 +1367,7 @@ describe("QdrantVectorStore", () => {
13491367
score_threshold: DEFAULT_SEARCH_MIN_SCORE,
13501368
limit: customMaxResults,
13511369
params: {
1352-
hnsw_ef: 128,
1370+
hnsw_ef: 256,
13531371
exact: false,
13541372
},
13551373
with_payload: {
@@ -1496,7 +1514,7 @@ describe("QdrantVectorStore", () => {
14961514
score_threshold: DEFAULT_SEARCH_MIN_SCORE,
14971515
limit: DEFAULT_MAX_SEARCH_RESULTS,
14981516
params: {
1499-
hnsw_ef: 128,
1517+
hnsw_ef: 256,
15001518
exact: false,
15011519
},
15021520
with_payload: {
@@ -1561,7 +1579,7 @@ describe("QdrantVectorStore", () => {
15611579
score_threshold: DEFAULT_SEARCH_MIN_SCORE,
15621580
limit: DEFAULT_MAX_SEARCH_RESULTS,
15631581
params: {
1564-
hnsw_ef: 128,
1582+
hnsw_ef: 256,
15651583
exact: false,
15661584
},
15671585
with_payload: {
@@ -1587,7 +1605,7 @@ describe("QdrantVectorStore", () => {
15871605
score_threshold: DEFAULT_SEARCH_MIN_SCORE,
15881606
limit: DEFAULT_MAX_SEARCH_RESULTS,
15891607
params: {
1590-
hnsw_ef: 128,
1608+
hnsw_ef: 256,
15911609
exact: false,
15921610
},
15931611
with_payload: {
@@ -1611,7 +1629,7 @@ describe("QdrantVectorStore", () => {
16111629
score_threshold: DEFAULT_SEARCH_MIN_SCORE,
16121630
limit: DEFAULT_MAX_SEARCH_RESULTS,
16131631
params: {
1614-
hnsw_ef: 128,
1632+
hnsw_ef: 256,
16151633
exact: false,
16161634
},
16171635
with_payload: {
@@ -1635,7 +1653,7 @@ describe("QdrantVectorStore", () => {
16351653
score_threshold: DEFAULT_SEARCH_MIN_SCORE,
16361654
limit: DEFAULT_MAX_SEARCH_RESULTS,
16371655
params: {
1638-
hnsw_ef: 128,
1656+
hnsw_ef: 256,
16391657
exact: false,
16401658
},
16411659
with_payload: {
@@ -1659,7 +1677,7 @@ describe("QdrantVectorStore", () => {
16591677
score_threshold: DEFAULT_SEARCH_MIN_SCORE,
16601678
limit: DEFAULT_MAX_SEARCH_RESULTS,
16611679
params: {
1662-
hnsw_ef: 128,
1680+
hnsw_ef: 256,
16631681
exact: false,
16641682
},
16651683
with_payload: {
@@ -1690,7 +1708,7 @@ describe("QdrantVectorStore", () => {
16901708
score_threshold: DEFAULT_SEARCH_MIN_SCORE,
16911709
limit: DEFAULT_MAX_SEARCH_RESULTS,
16921710
params: {
1693-
hnsw_ef: 128,
1711+
hnsw_ef: 256,
16941712
exact: false,
16951713
},
16961714
with_payload: {
@@ -1721,7 +1739,7 @@ describe("QdrantVectorStore", () => {
17211739
score_threshold: DEFAULT_SEARCH_MIN_SCORE,
17221740
limit: DEFAULT_MAX_SEARCH_RESULTS,
17231741
params: {
1724-
hnsw_ef: 128,
1742+
hnsw_ef: 256,
17251743
exact: false,
17261744
},
17271745
with_payload: {

src/services/code-index/vector-store/qdrant-client.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,12 @@ export class QdrantVectorStore implements IVectorStore {
155155
vectors: {
156156
size: this.vectorSize,
157157
distance: this.DISTANCE_METRIC,
158+
on_disk: true,
159+
},
160+
hnsw_config: {
161+
m: 64,
162+
ef_construct: 512,
163+
on_disk: true,
158164
},
159165
})
160166
created = true
@@ -244,6 +250,12 @@ export class QdrantVectorStore implements IVectorStore {
244250
vectors: {
245251
size: this.vectorSize,
246252
distance: this.DISTANCE_METRIC,
253+
on_disk: true,
254+
},
255+
hnsw_config: {
256+
m: 64,
257+
ef_construct: 512,
258+
on_disk: true,
247259
},
248260
})
249261
console.log(`[QdrantVectorStore] Successfully created new collection ${this.collectionName}`)
@@ -404,7 +416,7 @@ export class QdrantVectorStore implements IVectorStore {
404416
score_threshold: minScore ?? DEFAULT_SEARCH_MIN_SCORE,
405417
limit: maxResults ?? DEFAULT_MAX_SEARCH_RESULTS,
406418
params: {
407-
hnsw_ef: 128,
419+
hnsw_ef: 256,
408420
exact: false,
409421
},
410422
with_payload: {

0 commit comments

Comments
 (0)