You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(catalog): rank series and movies above episodes in search - #3474
Searching for a show can put one of its episodes above the show and its spinoffs. Searching "dexter" lists Dexter, then the pilot episode (also titled "Dexter"), then Dexter: New Blood and the other series. This shows up wherever search includes episodes: the iOS, tvOS, Android, and Android TV apps, the web app's All tab, and Jellyfin clients that search episodes. This change ranks every series, movie, and other catalog item above every episode. Episodes still appear after them.
The pilot ties the series on exact title. The next keys favor shorter title documents, and an episode's document holds one title while a series' holds its title, original title, and sort title, so the episode outranks every partial series match.
Approach
PostgreSQL search gets a new leading relevance key, media_rank: 1 for catalog items, 0 for episodes. It applies to the general query, the exact episode tier, and cursor continuation. postgresCursorConfig moves to postgres-relevance-v3 because the cursor tuple gained a key. jellycompat search uses the same provider, so it gets the same order without a separate change. The apps show results in server order and need no change.
Media rank orders full-text matches. Fuzzy matches, which run only when full text finds fewer than five results, still follow every full-text match, as before: a typo match for a series should not outrank a real text match for an episode. The architecture doc says so. docs/architecture/postgres-search.md describes the new order.
The Meilisearch provider is unchanged. Its federated search still weights media and episode hits equally, and changing that needs a new indexed field and an index rebuild, so it is left for a separate change.
Validation
Go build, gofmt, go vet ./...: clean.
make lint-changed and make lint-router-recovery (golangci-lint v2.12.2): 0 issues.
Catalog tests against PostgreSQL 18: pass. A new relevance case searches "dexter" across two series and the pilot, on the offset path and one row per cursor page; it fails without this change. The year-suffixed title test used an exact-title episode to stand in for an exact match, so it now uses a movie.
Search tests in apiv2, jellycompat, and API handlers: pass.
make test-go: every package passes except 11 tests in jellycompat, metadata/nfo, scanner, subtitles/subsync, and playback. They fail the same way on main on the macOS machine used here (case-insensitive file system, a broken local Node install, local FFmpeg and Dolby Vision tooling), and none touch search.
Web search (All tab), desktop and mobile, before on b811418 and after on 93dc1c1, plus the API response order for the web request and for the video_with_episodes request the Apple apps send. jellycompat search calls the same provider, so its order follows; the jellycompat search tests pass, and no separate Jellyfin client capture was made.
Risks
A search cursor issued before the upgrade is rejected once (invalid_cursor on /api/v2, catalog_cursor_changed on /api/v1), and the client starts the search over.
Ranking is now strict by type. Searching an episode's exact title lists any series or movie whose title matches the words before that episode.
Servers using Meilisearch keep the old mixed order.
Checklist
I read and can explain the complete diff.
This pull request addresses one concern.
Each test this pull request adds meets "Decide what to test" in CONTRIBUTING.md.
The Evidence section shows every change a user can see, or says there is none.
AI Disclosure
Harness: T3 Code running Claude Code
Tool(s): Claude Code
Model(s): claude-opus-5-5
Involvement: Fully AI-generated; human verification pending
Rank series and movies above episodes in catalog search
Search results now sort catalog items (series, movies) ahead of episodes before applying existing relevance keys. Episodes stay in results after catalog items.
Adds media_rank as the leading descending cursor term in searchFTSTerms and the first sort key in mixedSearchOrder (search_cursor.go, search_postgres_mixed.go).
Candidate rows get a media_rank column: 0 for episodes, 1 for everything else.
Exact-episode cursor validation now expects seven relevance scores instead of six, with shifted positions for the trailing cursor values (search_episode_exact.go).
Bumps the PostgreSQL relevance cursor config from v2 to v3; cursors issued before the relevance-key change are rejected (search_postgres_cursor_provider.go).
Behavioral Change: existing v2 search cursors become invalid; users paginating during deploys must restart their search.
- Add media_rank as the first relevance key so an episode titled like its show (Dexter's pilot "Dexter") no longer outranks the series
- Bump the cursor config to postgres-relevance-v3 so older cursors are rejected
- Shift the episode exact-tier cursor key indexes to account for the new key
- Update the search ranking docs and the relevance and year-title DB tests
silo-triageBot
added
the
size/M
50–199 added + deleted lines (all files); change volume, not priority.
label
Nov 4, 2026
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.
PostgreSQL search ordering now ranks non-episode catalog items ahead of episodes among full-text matches. Cursor ordering and validation account for the added media-rank key. Database tests and architecture documentation reflect the updated ordering.
The candidate query assigns episodes rank 0 and other items rank 1, then sorts by media rank before the remaining relevance keys. Database tests and architecture documentation reflect this order.
FTS cursor terms and exact-episode cursor validation account for the added ranking key. The cursor configuration changes from postgres-relevance-v2 to postgres-relevance-v3. The continued-search fixture and pagination comparison are updated.
Silo-Server/silo-server#2652: Changes PostgreSQL search relevance ordering and cursor configuration, which this change extends.
Merge Risk: Minimal · up to d5a95
The ranking and cursor changes preserve the documented full-text ordering contract, with no material merge risk established.
Pre-merge checks: 5
Check name
Status
Explanation
Title check
The title clearly and concisely describes the main change: ranking series and movies above episodes in catalog search.
Description check
The description directly explains the search-ranking change, implementation approach, cursor-version impact, validation, risks, and provider scope.
Docstring Coverage
Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentati…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage
Explanation
Docstring coverage is 83.33% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 6 functions across 7 files. (1 skipped: 1 unsupported.)
Finishing Touches
Generate unit tests (beta)
Commit to this branch
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Evidence is incomplete for the changed search ordering:
Apple search responses: the Evidence section names the video_with_episodes request but does not specify a before-and-after pair; include ordered-result excerpts for the same query on both commits.
Jellyfin-compatible search: this path also receives the new ordering, but no Jellyfin-compatible response is named; include before-and-after ordered results for the same query.
Automated check: Macroscope check run agent (gpt-6-luna). Evidence was not reviewed for correctness.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 3 remain after this review.
Android is affected too: All sends no type filter, so the shared search can return episodes and the app preserves the server's changed order. This changes the search data exercised by #347 C1 (Android phone/tablet) and #348 C1 (Android TV). The PR must explain why the behavior changes; its Problem and Approach sections do. Both task results are Not run, so they need human validation after merge, not re-validation of a prior pass.
Suggested fix: Validation tasks: changes #1252 C1; Silo-Server/silo-apple#337 C1; Silo-Server/silo-apple#338 C1; Silo-Server/silo-android#347 C1; Silo-Server/silo-android#348 C1 (all not run yet)
Automated check: Macroscope check run agent (gpt-6-luna). No validation was performed.
Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.
Reviewing changes in Silo
Include the related issue, expected behavior, and validation steps in the PR description.
For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
Follow this repository's AGENTS.md and CONTRIBUTING.md.
Request another review with @kody start-review in a PR comment.
React with 👍 or 👎 to give feedback on individual suggestions.
Review settingsReview Options
The following review options are enabled or disabled:
Options
Enabled
Bug
✅
Performance
✅
Security
✅
Business Logic
❌
⚠️ 4 Kody Rule(s) were not evaluated
These rules declare that they need repository context beyond this diff, and the review could not retrieve it, so they were not judged on this pull request:
Preserve optional store capabilities through production wrappers
Detach mandatory cleanup from request cancellation and bound its lifetime
Preserve durable media identity and share identity-evidence precedence
Bound decoder throughput trades and share direct-play eligibility
Validation impact: added Silo-Server/silo-android#347 C1 and #348 C1 to the Validation tasks: line. Both Android apps send no type filter on All, so they get the new order.
Evidence: the page has before and after web captures plus the API order for the video_with_episodes request. jellycompat search calls the same PostgreSQL provider, so I noted that in the body instead of adding a Jellyfin client capture.
The reason will be displayed to describe this comment to others. Learn more.
Additional comments: 1
docs/architecture/postgres-search.md-57-57: 1
57-57: Minor · Maintainability & Code Quality · Quick win
Unverified finding
Verification ran but could not confirm this finding. It is shown for review, not as a verified issue.
Clarify the full-text search subject.
Replace full text finds with the full-text search returns. This wording identifies the operation that produces fewer than five results and removes the ambiguity.
Source: Linters/SAST tools
Review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 955c5fde-6ac4-42b6-bbc2-01dd69241eea
Commits
Reviewing files that changed from the base of the PR and between 93dc1c1 and d5a9519.
Files selected for processing: 1
docs/architecture/postgres-search.md
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 2 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bugSomething isn't workinggoPull requests that update go codeimpact: polishAnnoyance, cosmetic, or nice-to-havepriority: P2Limited scope, workaround exists, or polishsize/M50–199 added + deleted lines (all files); change volume, not priority.
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Related issue: N/A
Validation tasks: changes #1252 C1; Silo-Server/silo-apple#337 C1; Silo-Server/silo-apple#338 C1; Silo-Server/silo-android#347 C1; Silo-Server/silo-android#348 C1 (all not run yet)
Searching for a show can put one of its episodes above the show and its spinoffs. Searching "dexter" lists Dexter, then the pilot episode (also titled "Dexter"), then Dexter: New Blood and the other series. This shows up wherever search includes episodes: the iOS, tvOS, Android, and Android TV apps, the web app's All tab, and Jellyfin clients that search episodes. This change ranks every series, movie, and other catalog item above every episode. Episodes still appear after them.
The pilot ties the series on exact title. The next keys favor shorter title documents, and an episode's document holds one title while a series' holds its title, original title, and sort title, so the episode outranks every partial series match.
Approach
PostgreSQL search gets a new leading relevance key,
media_rank: 1 for catalog items, 0 for episodes. It applies to the general query, the exact episode tier, and cursor continuation.postgresCursorConfigmoves topostgres-relevance-v3because the cursor tuple gained a key. jellycompat search uses the same provider, so it gets the same order without a separate change. The apps show results in server order and need no change.Media rank orders full-text matches. Fuzzy matches, which run only when full text finds fewer than five results, still follow every full-text match, as before: a typo match for a series should not outrank a real text match for an episode. The architecture doc says so.
docs/architecture/postgres-search.mddescribes the new order.The Meilisearch provider is unchanged. Its federated search still weights media and episode hits equally, and changing that needs a new indexed field and an index rebuild, so it is left for a separate change.
Validation
go vet ./...: clean.make lint-changedandmake lint-router-recovery(golangci-lint v2.12.2): 0 issues.make test-go: every package passes except 11 tests in jellycompat, metadata/nfo, scanner, subtitles/subsync, and playback. They fail the same way on main on the macOS machine used here (case-insensitive file system, a broken local Node install, local FFmpeg and Dolby Vision tooling), and none touch search.Evidence
Evidence: https://evidence.siloserver.org/r/silo-server/pr-3474/
Web search (All tab), desktop and mobile, before on b811418 and after on 93dc1c1, plus the API response order for the web request and for the
video_with_episodesrequest the Apple apps send. jellycompat search calls the same provider, so its order follows; the jellycompat search tests pass, and no separate Jellyfin client capture was made.Risks
invalid_cursoron/api/v2,catalog_cursor_changedon/api/v1), and the client starts the search over.Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Rank series and movies above episodes in catalog search
Search results now sort catalog items (series, movies) ahead of episodes before applying existing relevance keys. Episodes stay in results after catalog items.
media_rankas the leading descending cursor term insearchFTSTermsand the first sort key inmixedSearchOrder(search_cursor.go, search_postgres_mixed.go).media_rankcolumn: 0 for episodes, 1 for everything else.Macroscope summarized 93dc1c1.