Skip to content

fix(score): max_score follows the in-use scoring function on every shape - #21

Merged
eeeebbbbrrrr merged 1 commit into
tinql-parse-limitsfrom
max-score-contract
Oct 6, 2026
Merged

eeeebbbbrrrr merged 1 commit into
tinql-parse-limitsfrom
max-score-contract

Conversation

@claude

@claude claude Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #19.

Before: beside tin.score, tin.max_score returned NULL on multi-index scans (title ==> 'zebra' OR body ==> 'zebra') and mixed ORs (body ==> 'zebra' OR id = 1).

After: it returns the highest summed score of the in-use scoring function on every shape. This follows Eric's contract:

  1. tin.max_score() returns the highest BM25 score that the in-use scoring function would produce, regardless of query shape.
  2. With no scoring function in the query, use tin.full_score semantics.
  3. Both tin.score and tin.full_score are additive across different-Var predicates that have indexes from which a score can be calculated.

The fix deletes the NULL branch so the existing summed maximum pass runs. Tests compare max_score with max(score) over the same rows for score, full_score, and no scoring function, including split-arm shapes.

This intentionally diverges from current tin until TIN is fixed.

tin.max_score reports the highest score the relation's scoring function
would produce, whatever the query's shape: the tin.score policy beside
tin.score, and the tin.full_score policy otherwise. Under the tin.score
policy it returned NULL for several indexes or a disjunction with other
quals. Drop that branch so the summed maximum pass runs for every shape.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012mKGtrg7DEhVPgqYrJtHGg
@claude
claude Bot requested review from eeeebbbbrrrr and piki October 6, 2026 19:23
@eeeebbbbrrrr
eeeebbbbrrrr added this pull request to stack #20 October 6, 2026 20:17
@eeeebbbbrrrr
eeeebbbbrrrr marked this pull request as ready for review October 6, 2026 20:17
@eeeebbbbrrrr
eeeebbbbrrrr merged commit 11beb68 into main Oct 6, 2026
4 checks passed
@eeeebbbbrrrr
eeeebbbbrrrr deleted the max-score-contract branch October 6, 2026 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant