Skip to content

Postgres title search reports score 0.000 for every hit #1983

Closed

Description

@phernandez

What happened

Smoke test of Cloud development on core 1.0.0 (2026-10-30). bm_search(query="Core 1.0 smoke", mode="title") returned both matching notes in the right order (exact title first, from #1957), but each with score 0.000.

Why

As #1957 notes, a title-only search on Postgres has no rank: it filters with to_tsvector('english', search_index.title) @@ to_tsquery(...) and adds the exact-title leading_order_by, but nothing computes a score. SQLite ranks with bm25(), so the two backends disagree.

Why it matters

The order is right, so this is mostly cosmetic. But an agent reading "score 0.000" can take it as "no real match" and drop good results, and scores differ between local (SQLite) and Cloud (Postgres).

Fix

Give Postgres title search a score: ts_rank over the title vector, with the exact-title match ranked first as now (or a fixed top score for exact matches). Add a Postgres repository test that title hits have positive scores and the exact title still comes first.

Related: #1956, #1957.

🤖 Generated with Claude Code

Activity

  1. claude commented on Oct 30, 2026

    @claude
    Contributor

    Claude finished @phernandez's task in 15s —— View job


    Triage

    • Type: Bug (labeled bug)
    • Component: MCP search tool, backed by the Postgres search repository. The issue shows up on Cloud, so I applied the cloud label.
    • Priority: Low. Result order is correct. The only problem is that every title hit reports score 0.000, which an agent could misread as "no real match". Scores also differ between local (SQLite bm25()) and Cloud (Postgres).
    • Complexity: Simple. The suggested fix is to add a ts_rank score over the title vector in the Postgres title-only path. The exact-title ordering stays as it is, or exact matches get a fixed top score. Add a Postgres repository test for positive scores and exact-title-first ordering.
    • Duplicates: A search for similar issues found none. The issue references [BUG] Title search ranks an exact-title note below longer titles that contain it (bm25 normalizes by whole-row length) #1956 and fix(core): rank an exact title match first in title search #1957, which I did not open.
    • Reproduction: The issue has enough detail: bm_search(query="Core 1.0 smoke", mode="title") on Postgres.

    Per the triage-only scope, I haven't made any code changes.

  2. added this to the nextup milestone on Nov 3, 2026
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

    bugSomething isn't workingcloudBasic Memory Cloud

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions