(params)
| 214 | }, |
| 215 | |
| 216 | async fuzzySearch(params) { |
| 217 | const record = asRecord(params) |
| 218 | const dir = stringValue(record, "dir") |
| 219 | const query = typeof record.query === "string" ? record.query : "" |
| 220 | const limit = positiveInt(record.limit, DEFAULT_SEARCH_LIMIT) |
| 221 | const items = await walk(dir, { includeDirs: boolValue(record.matchDirs) }) |
| 222 | const ranked = items |
| 223 | .map((item) => ({ ...item, rank: rankMatch(item.relativePath, query) })) |
| 224 | .filter((item) => Number.isFinite(item.rank)) |
| 225 | .sort((a, b) => a.rank - b.rank || a.relativePath.localeCompare(b.relativePath)) |
| 226 | return { |
| 227 | results: ranked.slice(0, limit).map((item) => item.relativePath), |
| 228 | truncated: ranked.length > limit || items.length >= MAX_WALK_ENTRIES, |
| 229 | source: "fs", |
| 230 | } |
| 231 | }, |
| 232 | |
| 233 | async searchContent(params) { |
| 234 | const record = asRecord(params) |
nothing calls this directly
no test coverage detected