(projectRoot: string, embeddingModel: string, idx: Index)
| 197 | * better-sqlite3 can't load we still have the JSON. |
| 198 | */ |
| 199 | export async function persistIndex(projectRoot: string, embeddingModel: string, idx: Index): Promise<void> { |
| 200 | await saveIndex(indexPath(projectRoot, embeddingModel), idx).catch(() => {}); |
| 201 | try { |
| 202 | const { buildSqliteIndex } = await import('./sqlite-index.js'); |
| 203 | await buildSqliteIndex(projectRoot, embeddingModel, idx.chunks); |
| 204 | } catch { /* SQLite optional — JSON remains authoritative */ } |
| 205 | } |
| 206 | |
| 207 | /** |
| 208 | * Search the persisted index for a project, preferring the SQLite quantized |
no test coverage detected