opencode-rag-plugin 1.23.1 → 1.23.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -315,7 +315,9 @@ export declare class LanceDbStore implements VectorStore {
|
|
|
315
315
|
private ensureCosineIndex;
|
|
316
316
|
/**
|
|
317
317
|
* Perform a single index-metric repair pass. Skips stores that have no
|
|
318
|
-
* index and fewer than
|
|
318
|
+
* index and fewer than `MIN_ROWS_FOR_IVF_INDEX` rows (brute-force is
|
|
319
|
+
* optimal there, and an IVF index would only trip Lance's "dataset is too
|
|
320
|
+
* small" KMeans warning). Uses a
|
|
319
321
|
* single `createIndex` with `replace: true` — a dropIndex + createIndex
|
|
320
322
|
* sequence races in LanceDB ("Retryable commit conflict") and leaves the
|
|
321
323
|
* stale index in place. On failure the memo is cleared so the next
|
|
@@ -24,6 +24,15 @@ const MAX_INDEX_REPAIR_ATTEMPTS = 3;
|
|
|
24
24
|
* instead tells the user to rebuild the store.
|
|
25
25
|
*/
|
|
26
26
|
const MAX_STALE_INDEX_VERSIONS = 40;
|
|
27
|
+
/**
|
|
28
|
+
* Minimum row count for an IVF index to be worth building. Below this,
|
|
29
|
+
* brute-force flat scan is optimal and Lance's own KMeans trainer warns
|
|
30
|
+
* "dataset is too small to have a meaningful index" (it names this 4096
|
|
31
|
+
* floor) when too many of its 16 base partitions end up empty. Skipping
|
|
32
|
+
* index creation here keeps small stores warning-free and avoids a
|
|
33
|
+
* meaningless 9 MB index file.
|
|
34
|
+
*/
|
|
35
|
+
const MIN_ROWS_FOR_IVF_INDEX = 4096;
|
|
27
36
|
/**
|
|
28
37
|
* Count index-version directories in a LanceDB table directory. Each
|
|
29
38
|
* `createIndex` writes a new `<uuid>/` directory under `_indices`; a healthy
|
|
@@ -1115,7 +1124,9 @@ export class LanceDbStore {
|
|
|
1115
1124
|
}
|
|
1116
1125
|
/**
|
|
1117
1126
|
* Perform a single index-metric repair pass. Skips stores that have no
|
|
1118
|
-
* index and fewer than
|
|
1127
|
+
* index and fewer than `MIN_ROWS_FOR_IVF_INDEX` rows (brute-force is
|
|
1128
|
+
* optimal there, and an IVF index would only trip Lance's "dataset is too
|
|
1129
|
+
* small" KMeans warning). Uses a
|
|
1119
1130
|
* single `createIndex` with `replace: true` — a dropIndex + createIndex
|
|
1120
1131
|
* sequence races in LanceDB ("Retryable commit conflict") and leaves the
|
|
1121
1132
|
* stale index in place. On failure the memo is cleared so the next
|
|
@@ -1148,8 +1159,8 @@ export class LanceDbStore {
|
|
|
1148
1159
|
const stats = await table.indexStats(idxName);
|
|
1149
1160
|
if (stats && stats.distanceType === "cosine")
|
|
1150
1161
|
return; // already healthy
|
|
1151
|
-
if (!stats && count <
|
|
1152
|
-
return; //
|
|
1162
|
+
if (!stats && count < MIN_ROWS_FOR_IVF_INDEX)
|
|
1163
|
+
return; // small store — brute-force is optimal, and IVF would only trip Lance's "too small for a meaningful index" KMeans warning
|
|
1153
1164
|
const numPartitions = Math.max(16, Math.min(256, Math.floor(count / 256)));
|
|
1154
1165
|
for (let attempt = 1; attempt <= 3; attempt++) {
|
|
1155
1166
|
try {
|