Skip to content

feat(search): add index-free (no_index) live search mode#9565

Open
okatu-loli wants to merge 1 commit into
AlistGo:mainfrom
okatu-loli:feat/no-index-search
Open

feat(search): add index-free (no_index) live search mode#9565
okatu-loli wants to merge 1 commit into
AlistGo:mainfrom
okatu-loli:feat/no-index-search

Conversation

@okatu-loli

Copy link
Copy Markdown
Collaborator

需求 / Motivation

构建并维护搜索索引需要额外存储与定期维护,且索引可能滞后;对偶尔搜索的场景过重。对应 #9468

改动 / Change

在「搜索索引」设置新增 no_index 选项。选中后搜索不再查预建索引,而是从当前目录用 fs.WalkFS 实时遍历子树、对文件/目录名做关键词匹配(大小写不敏感、AND 语义,与索引后端一致):

  • max_index_depthignore_paths 约束,并对单次结果封顶 1000 条(提前中止遍历),避免大网盘打爆内存/耗时;
  • 不落任何索引(Index/BatchIndex/... 均为 no-op,AutoUpdate=false);
  • 结果按名称排序保证分页稳定;权限/隐藏路径过滤仍由搜索 handler 逐条处理。

Init/中间件无需改动(仅精确等于 none 才禁用搜索)。默认仍为 none,零回归,需用户手动切到 No index 才启用。

验证 / Verification

go build ./...go test ./internal/search/noindex/ 通过。

Closes #9468

Building and maintaining a search index costs storage and periodic
upkeep, and the index can lag behind the real files. For occasional
searches that is overkill.

Add a new search_index option "no_index" backed by a searcher that,
instead of querying a prebuilt index, walks the filesystem under the
requested parent on each search (bounded by max_index_depth, ignore_paths
and a 1000-result cap) and matches object names against the keywords with
the same case-insensitive AND semantics as the indexed backends. Index
mutating methods are no-ops and AutoUpdate is off, so nothing is
persisted. Existing permission/hidden-path filtering in the search
handler still applies to the results.

Closes AlistGo#9468
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

支持无索引搜索

2 participants