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

Method searchAllByFilters

src/db/queries.ts:1288–1308  ·  view source on GitHub ↗

* Match-everything path used when the user supplied only field * filters (`kind:function lang:typescript`) with no text. Returns * candidates ordered by name; the caller's filter pass narrows to * what was asked for.

(options: {
    kinds?: NodeKind[];
    languages?: Language[];
    limit: number;
  })

Source from the content-addressed store, hash-verified

1286 * what was asked for.
1287 */
1288 private searchAllByFilters(options: {
1289 kinds?: NodeKind[];
1290 languages?: Language[];
1291 limit: number;
1292 }): SearchResult[] {
1293 const { kinds, languages, limit } = options;
1294 let sql = 'SELECT * FROM nodes WHERE 1=1';
1295 const params: (string | number)[] = [];
1296 if (kinds && kinds.length > 0) {
1297 sql += ` AND kind IN (${kinds.map(() => '?').join(',')})`;
1298 params.push(...kinds);
1299 }
1300 if (languages && languages.length > 0) {
1301 sql += ` AND language IN (${languages.map(() => '?').join(',')})`;
1302 params.push(...languages);
1303 }
1304 sql += ' ORDER BY name LIMIT ?';
1305 params.push(limit);
1306 const rows = this.db.prepare(sql).all(...params) as NodeRow[];
1307 return rows.map((row) => ({ node: rowToNode(row), score: 1 }));
1308 }
1309
1310 /**
1311 * Fuzzy fallback: when zero FTS/LIKE hits, try an edit-distance

Callers 1

searchNodesMethod · 0.95

Calls 4

rowToNodeFunction · 0.85
allMethod · 0.65
prepareMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected