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

Method fuzzyNames

src/db/queries.ts:5062–5071  ·  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

5060 * against it, and the LIKE fallback asks it whether any name holds a word.
5061 */
5062 private fuzzyNames(): { names: string[]; lowered: string; starts: Int32Array } {
5063 const read = (): { names: string[]; lowered: string; starts: Int32Array } => {
5064 const names = this.getAllNodeNames();
5065 const lowered = names.map((name) => name.toLowerCase());
5066 const starts = new Int32Array(names.length + 1);
5067 for (let i = 0; i < lowered.length; i++) starts[i + 1] = starts[i]! + lowered[i]!.length + 1;
5068 return { names, lowered: lowered.join('\n') + '\n', starts };
5069 };
5070 return this.memoizedRead('fuzzyNames', read) ?? read();
5071 }
5072
5073 /**
5074 * 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