MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / fuzzyNames

Method fuzzyNames

src/db/queries.ts:4623–4632  ·  view source on GitHub ↗

* The distinct node names, in getAllNodeNames order, and the same * names lowercased and newline-joined: name `i` lowercased is * `lowered.slice(starts[i], starts[i + 1] - 1)`. Read once until the * database changes (fresh inside a transaction). The fuzzy fallback compares * agai

()

Source from the content-addressed store, hash-verified

4621 * against it, and the LIKE fallback asks it whether any name holds a word.
4622 */
4623 private fuzzyNames(): { names: string[]; lowered: string; starts: Int32Array } {
4624 const read = (): { names: string[]; lowered: string; starts: Int32Array } => {
4625 const names = this.getAllNodeNames();
4626 const lowered = names.map((name) => name.toLowerCase());
4627 const starts = new Int32Array(names.length + 1);
4628 for (let i = 0; i < lowered.length; i++) starts[i + 1] = starts[i]! + lowered[i]!.length + 1;
4629 return { names, lowered: lowered.join('\n') + '\n', starts };
4630 };
4631 return this.memoizedRead('fuzzyNames', read) ?? read();
4632 }
4633
4634 /**
4635 * The distinct file paths of the nodes, lowercased and newline-joined. Read

Callers 3

searchNodesFuzzyMethod · 0.95
searchNodesLikeMethod · 0.95
fieldFiltersCanMatchMethod · 0.95

Calls 2

memoizedReadMethod · 0.95
readFunction · 0.50

Tested by

no test coverage detected