docs(fs-search): 说明引擎行额与排除后置过滤的相互作用

引擎自己的上限(maxMatches + 1 哨兵)在 dispatch 的后置过滤之前生效,所以「前
maxMatches 行恰好全被排除」的根会返回更短的列表但 truncated: true——与遍历被
行额截断时给出的信号一致,不是静默缺口。这条限制写进 dispatch 的文档注释,
避免后人误以为后置过滤能补足到行额。
This commit is contained in:
Menghuan1918 committed 2026-10-05 02:42:09 +08:00
1 parent 3badac1981
commit 17bdae9975
1 file changed
+5
+5
View File
@@ -195,6 +195,11 @@ function engineExcludeProbe(root: string, exclude: ExcludeTest): (relativePath:
* contract — root-relative, '/'-separated, sorted, and split into
* matches/dirs — so the route and the client stay unchanged. A blank query
* matches nothing and touches neither the engines nor the filesystem.
*
* The engines keep their own cap (and report it through `truncated`), so a
* root whose first `maxMatches` rows are ALL excluded comes back short with
* `truncated: true` rather than silently hiding the remainder — the same
* signal a budget-cut walk gives.
*/
export async function searchFiles(root: string, query: string, opts: FsSearchOptions = {}): Promise<FsSearchResult> {
const needle = query.trim()