mirror of
https://github.com/colbymchenry/codegraph.git
synced 2026-10-29 14:49:36 +08:00
buildRoutes looked up node ids only for the first 60 distinct handler files, one getNodesInFile query each, so every later row went out with handlerId null and the viewer called the handler "not in the index". Load the nodes of every handler file in one chunked query instead (getNodesInFiles), which also drops the per-file query the cap existed to bound. Co-authored-by: danusha2345 <ewidusoc498@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
danusha2345
Claude Opus 5.5
parent
52df4d24ef
commit
6c414cc830
@@ -959,6 +959,24 @@ export class QueryBuilder {
|
||||
return rows.map(rowToNode);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all nodes in several files at once — one chunked `IN` query rather than
|
||||
* one {@link getNodesByFile} per file (#1975).
|
||||
*/
|
||||
getNodesByFiles(filePaths: readonly string[]): Node[] {
|
||||
const unique = [...new Set(filePaths)];
|
||||
const out: Node[] = [];
|
||||
for (let i = 0; i < unique.length; i += SQLITE_PARAM_CHUNK_SIZE) {
|
||||
const chunk = unique.slice(i, i + SQLITE_PARAM_CHUNK_SIZE);
|
||||
const placeholders = chunk.map(() => '?').join(',');
|
||||
const rows = this.db
|
||||
.prepare(`SELECT * FROM nodes WHERE file_path IN (${placeholders})`)
|
||||
.all(...chunk) as NodeRow[];
|
||||
for (const row of rows) out.push(rowToNode(row));
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the file that holds the densest concentration of the project's
|
||||
* internal call graph — the "core" file. Used by context-builder to
|
||||
|
||||
Reference in New Issue
Block a user