OpenListTeam / OpenListTeam/OpenList

[BUG] 数据库搜索索引无法删除已不存在的文件,刷新目录后仍能搜索到

Open
#2,881 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
24.7k
Forks
2.3k
Avg merge
1d 20h
Merged PRs (30d)
36

Description

Please confirm the following
  • I have read and agree to AGPL-3.0 Section 15 .
    The program is provided "as is" without any warranties; you bear all risks of using it.

  • I have read and agree to AGPL-3.0 Section 16 .
    The copyright holders and distributors are not liable for any damages resulting from the use or inability to use the program.

  • I confirm my description is clear, polite, helps developers quickly locate the issue, and complies with community rules.

  • I have read the OpenList documentation.

  • I confirm there are no duplicate issues or discussions.

  • I confirm this is an OpenList issue, not caused by other reasons (such as network, dependencies, or operation).

  • I believe this issue must be handled by OpenList and not by a third party.

  • I confirm this issue is not fixed in the latest version.

  • I have not read these checkboxes and therefore I just ticked them all, Please close this issue.

OpenList Version (required)

v4.2.3 (Commit: a92d59d) - Frontend: v4.2.3

Storage Driver Used (required)

115

Bug Description (required)

问题现象

OpenList 使用数据库搜索索引,并已开启“自动更新索引”。

索引中原本存在文件:

/115/测试.txt

该文件从底层存储删除后,在 OpenList 中进入 /115 目录并点击页面右下角的刷新按钮。目录列表已经确认从底层存储重新获取,文件也不再显示,但通过 OpenList 搜索仍然可以搜索到 /115/测试.txt

删除后已等待较长时间,并多次强制刷新 /115 目录,旧搜索结果仍然存在。点击该搜索结果访问文件时,底层存储返回 object not found,说明文件确实已经删除,搜索结果是残留的索引记录。

完整重新构建索引可以清理该记录,但目录强制刷新触发的增量索引更新无法删除它。

复现步骤

  1. 使用数据库搜索索引,并开启“自动更新索引”。
  2. 完整构建一次索引。
  3. 在某个已建立索引的目录中创建文件,例如 /115/测试.txt
  4. 确认该文件可以通过 OpenList 搜索找到。
  5. 删除该文件。
  6. 进入 /115 目录,点击页面右下角 tips="refresh" 的刷新按钮。
  7. 确认目录列表中已经没有 测试.txt
  8. 等待一段时间后,在 OpenList 中搜索 测试.txt
  9. 搜索结果仍然包含 /115/测试.txt
  10. 点击该搜索结果,日志显示文件 object not found

实际结果

目录刷新后,文件已经从目录列表消失,但对应的数据库搜索索引记录没有被删除。该文件会一直出现在搜索结果中,直到执行完整索引重建。

预期结果

强制刷新目录并从底层存储取得最新目录列表后,增量索引更新应当删除该目录下已经不存在的文件索引。

Logs (required)

17231:[GIN] 2026/07/31 - 03:10:29 | 200 | 1.58s | 171.221.219.39 | GET "/p/115/测试.txt?openlist_ts=1785467427113"
17236:ERRO[2026-07-31 03:10:37] failed link /115/测试.txt: object not found
17295:[GIN] 2026/07/31 - 03:10:37 | 500 | 4.12ms | 171.221.219.39 | GET "/p/115/测试.txt?openlist_ts=1785467436322"
17296:ERRO[2026-07-31 03:10:37] failed link /115/测试.txt: object not found
17355:[GIN] 2026/07/31 - 03:10:37 | 500 | 1.72ms | 171.221.219.39 | GET "/p/115/测试.txt"
17358:ERRO[2026-07-31 03:10:46] failed link /115/测试.txt: object not found
17417:[GIN] 2026/07/31 - 03:10:46 | 500 | 1.28ms | 171.221.219.39 | GET "/p/115/测试.txt?openlist_ts=1785467445788"
17418:ERRO[2026-07-31 03:10:46] failed link /115/测试.txt: object not found
17477:[GIN] 2026/07/31 - 03:10:46 | 500 | 350.18µs | 171.221.219.39 | GET "/p/115/测试.txt"

Configuration File Content (required)

部署方式:Docker

OpenList 镜像:

openlistteam/openlist:latest

运行版本:

v4.2.3 (Commit: a92d59d) - Frontend: v4.2.3

数据库:

{
  "database": {
    "type": "postgres",
    "db_file": ""
  }
}

### Reproduction Link (optional)

_No response_

### AI Generated Content (optional)

_No response_

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the database search index's automatic incremental update triggered by the directory refresh button, using the reported /115/测试.txt reproduction. Compare the refreshed directory contents with the retained search result and verify that deleting the file removes it from search without a full index rebuild.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, go, postgres
Domain
backend, databases, search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.