MCPcopy Create free account
hub / github.com/CodeGraphContext/CodeGraphContext / search

Method search

website/api/v1/lib/graph-engine.ts:150–171  ·  view source on GitHub ↗
(query: string, limit = 30)

Source from the content-addressed store, hash-verified

148 }
149
150 public search(query: string, limit = 30): GraphNode[] {
151 const queryLower = query.toLowerCase();
152 const matches: { node: GraphNode; score: number }[] = [];
153
154 for (const node of this.nodes.values()) {
155 const nameLower = node.name.toLowerCase();
156 const fileLower = (node.file || "").toLowerCase();
157
158 let score = 0;
159 if (nameLower === queryLower) score = 100;
160 else if (nameLower.startsWith(queryLower)) score = 80;
161 else if (nameLower.includes(queryLower)) score = 50;
162 else if (fileLower.includes(queryLower)) score = 20;
163
164 if (score > 0) matches.push({ node, score });
165 }
166
167 return matches
168 .sort((a, b) => b.score - a.score)
169 .slice(0, limit)
170 .map(m => m.node);
171 }
172
173 public getFileStructure(): { files: string[]; structure: Record<string, GraphNode[]> } {
174 const files: string[] = [];

Callers 15

parseMethod · 0.80
_infer_cxx_zero_kindMethod · 0.80
_parse_signatureMethod · 0.80
_extract_annotation_pathFunction · 0.80
parseMethod · 0.80
_parse_functionsMethod · 0.80
_walkMethod · 0.80
_extract_orm_mappingsMethod · 0.80
_parse_importsMethod · 0.80
pre_scan_javaFunction · 0.80
_find_variablesMethod · 0.80

Calls 3

mapMethod · 0.65
valuesMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected