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

Function classify

src/ui-server/api/search.ts:84–92  ·  view source on GitHub ↗
(node: Node, needle: string)

Source from the content-addressed store, hash-verified

82}
83
84function classify(node: Node, needle: string): MatchKind | null {
85 const name = node.name.toLowerCase();
86 if (name === needle) return 'exact';
87 if (name.startsWith(needle)) return 'prefix';
88 if (name.includes(needle)) return 'substring';
89 if (node.qualifiedName.toLowerCase().includes(needle)) return 'qualified';
90 if (node.filePath.toLowerCase().replace(/\\/g, '/').includes(needle)) return 'file';
91 return null;
92}
93
94export function buildSearch(cg: CodeGraph, query: URLSearchParams): unknown {
95 const raw = optionalTextParam(query, 'q');

Callers 1

buildSearchFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected