MCPcopy Create free account
hub / github.com/QodeXcli/QodeX / openSqliteIndex

Function openSqliteIndex

src/context/sqlite-index.ts:156–172  ·  view source on GitHub ↗
(
  projectRoot: string,
  embeddingModel: string,
)

Source from the content-addressed store, hash-verified

154}
155
156export async function openSqliteIndex(
157 projectRoot: string,
158 embeddingModel: string,
159): Promise<SqliteIndexHandle | null> {
160 const Database = await loadSqlite();
161 if (!Database) return null;
162 const p = sqliteIndexPath(projectRoot, embeddingModel);
163 try {
164 await fs.access(p);
165 } catch {
166 return null;
167 }
168 const db = new Database(p, { readonly: true });
169 const dimsRow: any = db.prepare("SELECT value FROM meta WHERE key='dims'").get();
170 const dims = dimsRow ? parseInt(dimsRow.value, 10) : 0;
171 return { db, dims };
172}
173
174export interface SqliteScored {
175 chunk: Chunk;

Callers 2

searchPersistedFunction · 0.85
retrieveRelevantFilesFunction · 0.85

Calls 3

loadSqliteFunction · 0.85
sqliteIndexPathFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected