Skip to content

[Bug] Saved search references with overlapping IDs or names depend on their order #9483

Closed

Description

@Busy-SweetPotato

Describe the bug

Combining saved searches whose names or IDs share a prefix can expand the longer reference as the shorter one and leave part of the original token in the search. The result depends on the order of otherwise equivalent OR clauses.

To reproduce

  1. Have articles by Alice, Bob, and an unrelated author.
  2. Save News with the search author:Alice and Newsletter with author:Bob.
  3. Search for search:Newsletter OR search:News.
  4. Compare with search:News OR search:Newsletter.

The first search expands to author:Alice letter OR author:Alice and returns only Alice's articles. The reverse order expands correctly to author:Alice OR author:Bob and returns both authors.

Numeric references have the same problem. With saved query 1 set to author:Alice and query 10 set to author:Bob:

Input Actual expansion Expected expansion
S:10 OR S:1 author:Alice 0 OR author:Alice author:Bob OR author:Alice
S:1 OR S:10 author:Alice OR author:Bob Same as actual

The unexpanded serialisation is also affected: S:1 S:10 becomes 0 S:1 S:10, and search:News search:Newsletter becomes letter search:News search:Newsletter.

Expected behaviour

Each saved query reference should expand independently. Changing the order of OR clauses should not remove an author's matching articles. Preserving an unexpanded search should not introduce suffixes from another reference.

Environment

  • FreshRSS 1.30.5-dev, edge commit 7de3c981d49f5d56cf73af05abaa92712629b7aa
  • PHP 8.5.8, built-in local PHP server, macOS 27.0.1 arm64
  • SQLite 3.53.4 with a synthetic feed and three local articles; no feed fetch required
  • Ego Lite / Chromium 154

The parser also reproduces independently of the browser. This is a reference replacement problem, separate from #5674's feed/category/state scope issue. Searches of existing issues/PRs and comparison with #8395 and #8543 did not find a matching fix as of 2026-10-22.

A focused fix and nine regression cases are prepared, and I will link the draft pull request here through its closing reference. The fix covers reference expansion and preservation of unexpanded searches.

Activity

  1. added this to the 1.31.0 milestone on Nov 1, 2026
  2. added
    Bug (unconfirmed)
    on Nov 1, 2026
  3. Alkarex commented on Nov 1, 2026

    @Alkarex
    Member
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

    Bug (unconfirmed)Search 🔍

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions