Skip to content

Message search returns all edit versions instead of only the latest #2058

Description

@usefmahmud

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.

Image

Reproduction

  1. Send a message "hello world"
  2. Edit the message like "hello matrix"
  3. Edit the message again "hello matrix 2"
  4. 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).

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions