Describe the bug
When searching for messages, if a message has been edited multiple times, the search results display all edit versions as separate results instead of only the most recent one. This creates duplicate/near-duplicate entries in the results, cluttering the search experience.
Reproduction
- Send a message "hello world"
- Edit the message like "hello matrix"
- Edit the message again "hello matrix 2"
- Search for the term "hello" used in the edits
Expected behavior
Only the latest version should appear in the search results for each message.
Platform and versions
1. OS: macOS 26.1
2. Browser: Arc 1.162.0 (Chromium 152.0.7977.65)
3. Sable: v1.21.0
4. Homeserver: matrix.org
Additional context
Suggested Fix
deduplicate search results by grouping items that share the same original event_id, and keep only the one with the highest origin_server_ts (the latest version).
Describe the bug
When searching for messages, if a message has been edited multiple times, the search results display all edit versions as separate results instead of only the most recent one. This creates duplicate/near-duplicate entries in the results, cluttering the search experience.
Reproduction
Expected behavior
Only the latest version should appear in the search results for each message.
Platform and versions
Additional context
Suggested Fix
deduplicate search results by grouping items that share the same original
event_id, and keep only the one with the highestorigin_server_ts(the latest version).