Unified search shows a file twice when a provider entry has both fileId and path
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
从 issue 中描述的 iOSClient/Main/Collection Common/NCCollectionViewCommon+Search.swift 里的 getSearchResultMetadatas default 分支开始。追踪同时具有 fileId 和 filePath 的条目是如何处理的,然后检查附近搜索测试的覆盖情况。当本地已知且带有这两个属性返回的文件在 provider 部分只出现一次时,即为完成。
由索引模型根据 Issue 内容生成。
描述
How to use GitHub
- Please use the 👍 reaction to show that you are affected by the same issue.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Steps to reproduce
- Have a unified search provider, other than
files, whose entries carry both afileIdand apathattribute. Seen with paperless_unified_search 1.3.0. - Open a file in the app, or the folder holding it, so the file is in the app's local database.
- Search for a term that returns that file from the provider.
Expected behaviour
The file appears once in the provider's section.
Actual behaviour
The same file appears twice in the provider's section. Both rows show the same folder.
Logs
The cause looks like the default: branch of getSearchResultMetadatas in iOSClient/Main/Collection Common/NCCollectionViewCommon+Search.swift (tag 35.2.2; the same code is on master):
if let fileId = entry.fileId,
let metadata = database.getMetadataFromFileId(String(fileId), account: session.account) {
metadata.section = provider.name
metadatas.append(metadata) // first append, no continue
}
if let filePath = entry.filePath,
let metadata = await loadMetadata(session: session,
provider: provider,
filePath: filePath) {
metadatas.append(metadata) // second append of the same file
continue
}
The first if has no continue, so an entry whose file is already known locally is appended by ID and then again by path. A continue after the first append looks like the fix.
What I checked:
- The server sends one entry. The provider's response for the term held
entriesof length 1, with{"fileId": "...", "path": "/.../file.pdf"}inattributes. - The file exists once in the server's file cache.
- Removing the
fileIdattribute on the server leaves one entry with onlypath, which should take only the second branch. I have not yet confirmed that on the device.
I found this by reading the source, with help from Claude Code. I did not build the app or run it under a debugger.
Reasoning or why should it be changed/implemented?
Any provider that returns real files can show each previously opened file twice, which reads as a duplicate on the server.
Environment data
iOS version: not recorded
Nextcloud iOS app version: 35.2.2
Server operating system: Debian 13 (Nextcloud Docker image)
Web server: Apache 2.4
Database: PostgreSQL 18
PHP version: 8.5.12
Nextcloud version: 35.0.2
- 主要语言
- Swift
- 星标
- 2.5k
- 派生
- 1k
- 平均合并
- 1 天 16 小时
- 30 天内合并 PR
- 23
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
nextcloud/ios 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Modify action only shown in context menu可能已有人在做 @mpivchev 于 19 天前认领。 未关闭bug
难度 2/5 1-3 小时 新手友好度 70/100
nextcloud/ios#4332 · 2 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 70/100
维护者通常 1 天内回复
-
Recursively sync: better error handling可能已有人在做 @marinofaggiana 于 1 天前认领。 未关闭
nextcloud/ios#4456 · 已指派 1 人 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 74/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 83/100
paritytech/polkadot-ios-community#415 ·
维护者通常 1 天内回复
-
area:infra enhancement
难度 2/5 1-3 小时 新手友好度 74/100
axeslasher/Jelly-Shark#352 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
abue-ammar/tinycast#1875 · 2 条评论 ·
维护者通常 1 天内回复