MCPcopy
hub / github.com/colbymchenry/codegraph / searchAllByFilters

Method searchAllByFilters

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

898 * what was asked for.
899 */
900 private searchAllByFilters(options: {
901 kinds?: NodeKind[];
902 languages?: Language[];
903 limit: number;
904 }): SearchResult[] {
905 const { kinds, languages, limit } = options;
906 let sql = 'SELECT * FROM nodes WHERE 1=1';
907 const params: (string | number)[] = [];
908 if (kinds && kinds.length > 0) {
909 sql += ` AND kind IN (${kinds.map(() => '?').join(',')})`;
910 params.push(...kinds);
911 }
912 if (languages && languages.length > 0) {
913 sql += ` AND language IN (${languages.map(() => '?').join(',')})`;
914 params.push(...languages);
915 }
916 sql += ' ORDER BY name LIMIT ?';
917 params.push(limit);
918 const rows = this.db.prepare(sql).all(...params) as NodeRow[];
919 return rows.map((row) => ({ node: rowToNode(row), score: 1 }));
920 }
921
922 /**
923 * Fuzzy fallback: when zero FTS/LIKE hits, try an edit-distance

Callers 1

searchNodesMethod · 0.95

Calls 4

rowToNodeFunction · 0.85
joinMethod · 0.80
allMethod · 0.65
prepareMethod · 0.65

Tested by

no test coverage detected