Repository navigation
fix(core): rank an exact title match first in title search - #1957
Conversation
bm25 normalizes by the whole row's token count, so among notes whose titles all contain the query, the one with the shortest body ranked first. The note titled exactly the query could rank below "Project Atlas meeting notes ...". Postgres title-only searches had no rank and came back in id order. Title search now sorts an exact (case-insensitive) title match ahead of the score on both backends. Reported with a minimal repro by @Flynn-Kawolsky. Fixes #1956 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CMYVL1x91B8kJxy7nn2GU8 Signed-off-by: phernandez <paul@basicmachines.co>
|
@codex review |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex Review: Didn't find any major issues. Can't wait for the next one! Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
The read_note paging test asserted the exact title ranked past the first lookup page, which was the #1956 bug. Title search now sorts it first. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CMYVL1x91B8kJxy7nn2GU8 Signed-off-by: phernandez <paul@basicmachines.co>
|
@codex review |
|
Codex Review: Didn't find any major issues. 👍 Reviewed commit: ℹ️ About Codex in GitHubCodex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback". |
## Why `just release v1.0.0` pre-flight-checks for a `## v1.0.0` heading on `main`, so the changelog has to land first. ## What changed `CHANGELOG.md`: the Unreleased section becomes `## v1.0.0 (2026-10-29)`. Its existing items are kept, and the 60 or so commits since #1871 are added: - **Breaking:** - the MCP surface is only `bm_*`, with the old tools deleted (#1944, #1947, #1959, #1962–#1964) - `project` is required (#1934) - the ChatGPT adapters moved to Cloud - `bm tool` mirrors the tools (#1943) - the POSIX verbs are rebuilt and `bm tail` is removed (#1960) - cloud sync/bisync are removed (#1953) - `bm schema` project resolution (#1959) - LiteLLM is an optional extra - **Features:** text-file line ranges in `bm_read`; chat imports return their file paths. - **Bug fixes:** including the three found in the 1.0 live test (#1971, #1972, #1974), with contributor credits for @Flynn-Kawolsky (#1957), @SWSAmor (#1951) and @MbappeWU (#1948). - **Security:** the CodeRabbit deep-scan hardening batch. I checked the entries against PR bodies rather than titles, and corrected #1954, #1948 and #1967 to describe what they actually fixed. The date is today; change it if the tag lands tomorrow. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01CMYVL1x91B8kJxy7nn2GU8 Signed-off-by: phernandez <paul@basicmachines.co> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #1956.
Problem
Title search (
search_type="title", CLI--mode title) filters on the title column and ranks withbm25(). FTS5 normalizes bm25 by the whole row's token count, not the title's. When every candidate matches only in its title, the shortest body wins, soProject Atlascould rank belowProject Atlas meeting notes 2026-10-02. The #1882 column weights scale every row equally and don't change the order. On Postgres a title-only search has no rank at all and returns matches in id order.Fix
CompiledFiltergets aleading_order_bykey that both backends put ahead of the score. Title search sets it to(lower(search_index.title) = lower(:title_exact)) DESC, so an exact title match sorts first and the existing score orders the rest. SQLite'slower()folds ASCII only, so a non-ASCII title must match case exactly to get the boost; it still matches and ranks by bm25 otherwise.Tests
test_title_search_ranks_exact_title_firstcreates the exact-title note second, with the longer body, so neither bm25 nor the id tie-break favors it. It fails on main and passes here on SQLite and Postgres.just fast-check, all-k searchSQLite unit tests (1160 passed), and the Postgres search repository tests pass.Thanks to @Flynn-Kawolsky for the report and the minimal repro.
🤖 Generated with Claude Code
https://claude.ai/code/session_01CMYVL1x91B8kJxy7nn2GU8