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(search): return specific Meilisearch results and rebuild the index in minutes - #4472
Related issue: #4396
Validation tasks: changes #199 (search as you type) and #1252 CORE1 (search items and people as you type): with Meilisearch as the provider, a partly typed cast name no longer finds that person's titles; the People row uses its own search and is unchanged
Other clients: N/A (server-side ranking; every client and jellycompat read the same provider, so none needs a change)
With Meilisearch as the search provider, searches returned long lists of loosely related titles, searches that should match by meaning often fell back to keywords without saying so, and a full index rebuild took over two hours on a large library. This change makes the results specific to what was typed and cuts the rebuild to about a quarter of an hour.
On a test server with a large catalog index, part of it with embeddings, and Meilisearch 1.54.0:
19 of 28 multi-word searches fell back to keyword search. A meaning-only query with rankingScoreThreshold keeps searching until searchCutoffMs (1,500 ms) whenever fewer hits than the limit clear the threshold, and Silo's 800 ms timeout fired first. The fallback was not logged. The other 9 filled the whole 1,000-item window with meaning matches.
back to the future returned 994 movies, 989 of them matching one word. tom hanks matched titles with "Tom" in one cast name and "Hanks" in another. scrubs listed eight titles because the word appears once in their synopsis, and five more through cast names one letter away.
A rebuild took 2 h 21 min with Meilisearch holding 12–17 GB of memory. An update of two documents on the finished index took 69 s.
Approach
Search. A hybrid search is now one plain /multi-search: keyword queries and a meaning-only query, merged in Go. The meaning query fetches 100 candidates with no threshold; Silo keeps those above the existing score floor and within a margin of the best one, so a title search keeps a handful of neighbours and a descriptive search keeps its cluster. Keyword hits are cut at the first one that matches fewer words, has more typos, or has its words further apart than the best hit. That relies on the ranking rules starting with words, typo, proximity, and a test guards the order. Cast and crew match whole words through a second, quoted-phrase query, because Meilisearch has no per-attribute switch for prefix matching. Three or more words use the frequency strategy, and excluded terms are no longer embedded. A failed hybrid search is logged once.
Index. The overview and tagline are no longer indexed; the item's embedding covers the synopsis by meaning, and genres and keywords stay searchable. The year is searchable, the largest vote count across rating sources breaks ties, typo tolerance is off for people, and the cast is indexed in billing order so a name search leads with the titles that person leads. The document shape changed, so the schema version goes from 3 to 4 and every install rebuilds once.
Rebuilds. Index settings other than the embedder are now applied in place: catalog_search_index_state.settings_fingerprint records what the active index was brought to, and the sync task patches the index when it differs. Only a change to the document shape or the embedder still rebuilds. A rebuild deletes leftover and failed build indexes, splits payloads by their encoded size, and keeps 16 tasks queued instead of 4 so Meilisearch indexes larger batches. The omnibus image defaults MEILI_MAX_INDEXING_MEMORY to a quarter of the container's memory, read through a new silo memory-limit subcommand so it uses the same detection as the PostgreSQL tuning. The admin search status reports a missing active index as degraded with a rebuild required.
docs/architecture/meilisearch-index.md is new and holds the rules: what triggers a rebuild, how searches behave while settings are pending, which keyword hits are kept, and why people are a separate query.
This is several related changes in one pull request, at the owner's request. It can be split along the three headings above if that reviews better.
Validation
gofmt, go mod tidy -diff, go build, go vet: clean.
make lint-changed, make lint-router-recovery: 0 issues.
make test-go: passes. Four packages unrelated to this change (api/handlers, backup, ebookconvert, uploads) fail under the test machine's group-writable umask and pass with umask 022.
Settings bindings, route inventory, OpenAPI, contract, fixtures, router artifact, local paths, case collisions, ShellCheck, size ratchet, bidi, migrations: pass.
Not run: the web lint, format, build, budget and test steps (no web files changed), verify-playback-fixtures, verify-apiv2-web-types, verify-actionlint, verify-prometheus-rules.
New tests cover the hybrid merge, the keyword cut, combining keyword and people hits, the people phrase, request shapes, payload splitting, the choice between rebuilding and patching settings, failed-rebuild cleanup, and the missing-index status. The offset-paging loop's early stop on a cut has no test.
The omnibus start script's memory default was not run in an image. Its value was tested by setting the same variable on the test server.
Evidence
Surface and build: native API GET /api/v2/catalog, movies and series, on a test server running this branch against the index described above. "Before" is main with Meilisearch enabled.
Search
Before
After
back to the future (movies)
994 results
6: the trilogy, two titles containing the phrase, one meaning match
forest gump
100 results, 98 from meaning
2: Forrest Gump and its making-of
tom hanks
titles with his name, then documentaries he narrates
titles with his name, then Forrest Gump, Saving Private Ryan, The Green Mile, Toy Story
denis villeneuve
1 result
Dune, Dune: Part Two, Blade Runner 2049, Enemy, Arrival
scrubs
38 results, 8 of the first 10 from synopsis mentions
Scrubs and Scrubs (2026)
heat (movies)
1,000 results
205; Heat (1995) first
inception
the 1980 film first
the 2010 film first
dune 2021
The Dune (2014) first
Dune (2021) first
movie about a shark
keyword matches on "movie"
1 keyword match and 100 shark films by meaning
Rebuild of the same library
Time
Peak Meilisearch memory
Before
2 h 21 min
17 GB
With the 8 GiB indexing memory cap
48 min
2.6 GB
Overview and tagline dropped
24 min
Larger batches
14–16 min
A ranking-rule change was applied to the live index in 0.03 s with no rebuild. Hybrid search ran for all 31 multi-word searches in the test set (median 664 ms) where 9 of 28 ran before. A cancelled rebuild's partial index was deleted by the next run.
Risks
One rebuild per install. The schema version bump rebuilds the index on first start, and search uses PostgreSQL until it finishes.
Two migrations. One adds the nullable settings_fingerprint column. The other moves a stored rebuild_task_queue_depth of 4 to 16; the setting has no web control, so a stored 4 is the seeded default.
Name type-ahead. A partly typed cast name no longer finds titles; see the validation line above.
Excluding a name no longer covers the cast.toy story -hanks used to drop every title crediting a Hanks; 11 of its 36 results now credit one, because the exclusion applies only to the attributes the keyword query searches. Not fixed here.
Misspelled names depend on the meaning half: denis villenueve still finds his films, christopher nolen does not.
Near-miss titles drop out when an exact match exists: scrubs no longer lists Scrublands.
PostgreSQL search still matches overviews, so the two providers differ on synopsis matches.
Calibration. The score floor and margin were measured with one embedding model (3072 dimensions, binary quantized).
Setting label. The last matching-strategy option reads "Drop trailing words until something matches"; searches of three or more words now use frequency. The label needs a silo-translations change, not made here.
Rolling upgrades. Two server versions with different index settings sharing one index would each re-apply their own until one version runs.
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 how I checked a change nobody sees.
AI Disclosure
Harness: Claude Code, run inside T3 Code
Tool(s): Claude Code
Model(s): claude-fable-5-2 (lead), claude-opus-5-5 (subagents that audited and wrote the changes)
Involvement: Fully AI-generated, human verified
Adversarial review: one independent read-only review of the final diff by a separate claude-opus-5-5 agent, briefed without the author's view of the risks. It reported no defect introduced by this change in paging, de-duplication, the keyword cut, the hybrid merge, index maintenance or the migrations. It did report problems that predate the change and are not fixed here: provider error text can reach search_diagnostics.fallback_reason, a rebuild whose advisory lock is lost can have its index deleted by another node, and a cursor search that hits a just-replaced index stays on PostgreSQL for that session.
Replace federated Meilisearch search with per-query multi-search and speed up index rebuilds
Hybrid search no longer uses Meilisearch federation. It now sends separate keyword and meaning queries in one multi-search request, then merges the results with score floors and margins in search_meilisearch_provider.go. Keyword searches also issue a separate people query and merge rankings using ranking-score details.
Rebuilds run faster: the default rebuild task queue depth rises from 4 to 16, documents are batched by actual encoded payload size, and rebuilds apply an in-place settings update (tracked by a settings fingerprint) instead of a full rebuild when only settings changed, in search_indexer.go.
Rebuild failure handling improves: leftover and unpublished build indexes are deleted, and failed rebuilds are cleaned up even when the context is canceled.
Status now detects a missing active Meilisearch index, reports PostgreSQL as the active provider with zero documents, and marks a rebuild as required. It can take up to five minutes to appear (per admin-api.md).
Search documents drop overview and tagline fields and add popularity; the Meilisearch service derives its indexing-memory limit from container memory in the omnibus image.
Behavioral Change: SearchMeilisearchSchemaVersion rises from 3 to 4, so existing indexes rebuild on first sync. New settings_fingerprint column added to catalog_search_index_state by migration. Searches with below-floor meaning matches or exclusion-only queries now report keyword mode; keyword result windows may return fewer candidates due to the first-worse-match cutoff.
Hybrid search failed or flooded results, keyword search carried a long tail
of weak matches, and a full index rebuild took over two hours.
Search:
- Run hybrid search as plain multi-search queries merged in Go. A score
threshold on a vector query made Meilisearch search until its cutoff, which
outlived the client timeout. The meaning half is capped, held to the score
floor, and kept within a margin of its best hit.
- Cut keyword hits at the first one that matches fewer words, has more typos,
or has its words further apart than the best hit.
- Match people as whole words through a separate phrase query.
- Use frequency matching for three or more words; do not embed excluded terms.
- Log a hybrid search that fails and falls back to keyword search.
Index:
- Stop indexing overview and tagline; make year searchable; break ties by
vote count; turn typo tolerance off for people; index cast in billing order.
- Apply index settings in place through a settings fingerprint instead of
rebuilding; only the document shape and embedder need a rebuild.
Rebuild:
- Delete leftover and failed build indexes; report a missing active index in
the admin status.
- Split payloads by encoded size and keep 16 tasks queued.
- Default Meilisearch's indexing memory to a quarter of the container in the
omnibus image.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
No actionable comments were generated in the recent review.
Walkthrough
Catalog search now tracks settings fingerprints, updates index settings in place, and revises search ranking and missing-index status. A new silo memory-limit command reports detected memory, and the Meilisearch startup script uses it to set an indexing-memory limit.
Changes: Catalog Search
Layer / File(s)
Summary
Index state and maintenance internal/catalog/search_index_repo.go, internal/catalog/search_indexer.go, internal/catalog/search_provider.go, internal/config/admin_settings.go, migrations/sql/*, internal/catalog/search_indexer_test.go, docs/architecture/meilisearch-index.md
Index state stores settings fingerprints. Sync distinguishes rebuilds from in-place settings updates, records fingerprints, and uses a rebuild queue depth of 16.
Index builds and document payloads internal/catalog/search_indexer.go, internal/catalog/search_indexer_test.go, internal/catalog/search_provider_test.go
Rebuilds clean up stale and failed indexes. Document uploads use encoded-size-limited payloads. Indexed fields and settings change to include popularity and year, and omit overview and tagline.
Search requests and ranking internal/catalog/search_meilisearch_*.go, internal/catalog/search_provider.go, internal/catalog/search_provider_test.go, internal/catalog/search_meilisearch_hybrid_test.go, docs/architecture/meilisearch-index.md, docs/catalog-api.md
Search uses non-federated multi-search. Keyword, people, and meaning hits are filtered and merged using ranking details, score thresholds, and query-dependent matching strategies.
Missing-index status reporting internal/catalog/search_service.go, internal/catalog/search_provider.go, internal/catalog/search_provider_test.go, docs/admin-api.md
When the active Meilisearch index is missing, status selects PostgreSQL, reports zero documents, and marks the index rebuild-required and the service degraded.
The memory-limit command prints the detected memory limit. When MEILI_MAX_INDEXING_MEMORY is unset, the startup script sets it to at least 512 MiB and otherwise to one quarter of detected memory; detection failures produce a warning.
sequenceDiagram
participant SearchProvider
participant MeilisearchClient
participant Meilisearch
SearchProvider->>MeilisearchClient: Submit keyword and meaning queries
MeilisearchClient->>Meilisearch: POST /multi-search
Meilisearch-->>MeilisearchClient: Return query results and ranking details
MeilisearchClient-->>SearchProvider: Return search hits
SearchProvider->>SearchProvider: Filter and merge hits into ranked results
Loading
Possibly related issues
Silo-Server/silo-server#4396: The ranking changes affect meaning-match scoring and keyword filtering, but do not change TMDB request placement, so they do not address the full issue objective.
Suggested reviewers:rhainland, blurbery
Merge Risk: Minimal · up to 0e4a7
This change reworks catalog search ranking, index settings maintenance and missing-index status reporting, and adds a memory-limit startup default. No unresolved merge-blocking issue was identified in the supplied review.
Security architecture risk: Minimal · up to 0e4a7
The inspected changes preserve catalog access checks and index ownership controls. Settings updates are recorded after completion, rebuild publication retains recovery safeguards, and the startup memory default respects explicit configuration. No introduced or worsened security or failure-containment concern was established.
Retained concerns
No architecture-level concerns identified.
Security review details
Security Blast Radius
inferred — The inspected search exposure remains the catalog behind the server-selected active index, with user-controlled terms influencing retrieval and ranking rather than index ownership. Maintenance has broader destructive reach within the configured Meilisearch instance: cleanup selects rebuild-prefixed leftovers and the explicitly previous active UID, while excluding the active UID.
Trust Boundaries and Controls
observed — Meilisearch results remain candidates, not authorization decisions. Queries carry library constraints, and final PostgreSQL hydration reapplies library, maturity, and excluded-media controls for media and episodes. Continuations retrieve sessions by user identity, validate request scope and configuration, and reauthorize returned items. The inspected v2 status route requires the acting-admin gate.
Resilience and Maintainability Implications
inferred — The inspected failure paths preserve separation between advisory capability failures and keyword-search availability. Missing or incompatible indexes use PostgreSQL fallback, and a request encountering a just-replaced index refreshes state and retries a compatible replacement once. These controls contain rebuild and probe failures without making capability metadata an authorization dependency.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the two main changes: Meilisearch search result specificity and faster index rebuilds. Both appear in the diff, including the search provider, indexer, rebuild queue depth, and setting…
Description check
The description explains the problem (overly broad Meilisearch results, slow two-hour rebuilds), the approach (multi-search hybrid merge, index settings changes, in-place settings patching, memory lim…
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: Title check
Explanation
The title names the two main changes: Meilisearch search result specificity and faster index rebuilds. Both appear in the diff, including the search provider, indexer, rebuild queue depth, and settings fingerprint changes. The title is a single sentence, but it covers a broad multi-part PR, which the author acknowledges. It is related to the main change.
Full details: Description check
Explanation
The description explains the problem (overly broad Meilisearch results, slow two-hour rebuilds), the approach (multi-search hybrid merge, index settings changes, in-place settings patching, memory limit subcommand), validation, risks, and a documentation file. It matches the changeset closely.
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
Recent 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: 30c042ca-27f5-494d-9f31-5a9b13f9295e
Commits
Reviewing files that changed from the base of the PR and between 68bc688 and 0e4a7d5.
Files selected for processing: 3
internal/catalog/search_meilisearch_provider.go
internal/catalog/search_provider_test.go
internal/catalog/search_service.go
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
silo-triageBot
added
bug
Something isn't working
go
Pull requests that update go code
needs-review
Needs maintainer review to resolve uncertain classification, scope, or changed evidence.
priority: P2
Limited scope, workaround exists, or polish
labels
Nov 18, 2026
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
…status
The status probed the active index only when no rebuild was required, so a
keyword-only index that had gone missing still reported Meilisearch and its
old document count.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
The capability probe's answer was cached for five minutes regardless of which
index it described, so a rebuild that published a new index kept reporting
the old one's result. The status now probes keyword-only indexes too, which
made a stale negative answer more likely.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
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
❌
⚠️ 5 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
Retain distributed firing claims through their own validity windows
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 codeneeds-reviewNeeds maintainer review to resolve uncertain classification, scope, or changed evidence.priority: P2Limited scope, workaround exists, or polishsize/XXL1000–2999 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: #4396
Validation tasks: changes #199 (search as you type) and #1252 CORE1 (search items and people as you type): with Meilisearch as the provider, a partly typed cast name no longer finds that person's titles; the People row uses its own search and is unchanged
Other clients: N/A (server-side ranking; every client and jellycompat read the same provider, so none needs a change)
With Meilisearch as the search provider, searches returned long lists of loosely related titles, searches that should match by meaning often fell back to keywords without saying so, and a full index rebuild took over two hours on a large library. This change makes the results specific to what was typed and cuts the rebuild to about a quarter of an hour.
On a test server with a large catalog index, part of it with embeddings, and Meilisearch 1.54.0:
rankingScoreThresholdkeeps searching untilsearchCutoffMs(1,500 ms) whenever fewer hits than the limit clear the threshold, and Silo's 800 ms timeout fired first. The fallback was not logged. The other 9 filled the whole 1,000-item window with meaning matches.back to the futurereturned 994 movies, 989 of them matching one word.tom hanksmatched titles with "Tom" in one cast name and "Hanks" in another.scrubslisted eight titles because the word appears once in their synopsis, and five more through cast names one letter away.Approach
Search. A hybrid search is now one plain
/multi-search: keyword queries and a meaning-only query, merged in Go. The meaning query fetches 100 candidates with no threshold; Silo keeps those above the existing score floor and within a margin of the best one, so a title search keeps a handful of neighbours and a descriptive search keeps its cluster. Keyword hits are cut at the first one that matches fewer words, has more typos, or has its words further apart than the best hit. That relies on the ranking rules starting with words, typo, proximity, and a test guards the order. Cast and crew match whole words through a second, quoted-phrase query, because Meilisearch has no per-attribute switch for prefix matching. Three or more words use thefrequencystrategy, and excluded terms are no longer embedded. A failed hybrid search is logged once.Index. The overview and tagline are no longer indexed; the item's embedding covers the synopsis by meaning, and genres and keywords stay searchable. The year is searchable, the largest vote count across rating sources breaks ties, typo tolerance is off for people, and the cast is indexed in billing order so a name search leads with the titles that person leads. The document shape changed, so the schema version goes from 3 to 4 and every install rebuilds once.
Rebuilds. Index settings other than the embedder are now applied in place:
catalog_search_index_state.settings_fingerprintrecords what the active index was brought to, and the sync task patches the index when it differs. Only a change to the document shape or the embedder still rebuilds. A rebuild deletes leftover and failed build indexes, splits payloads by their encoded size, and keeps 16 tasks queued instead of 4 so Meilisearch indexes larger batches. The omnibus image defaultsMEILI_MAX_INDEXING_MEMORYto a quarter of the container's memory, read through a newsilo memory-limitsubcommand so it uses the same detection as the PostgreSQL tuning. The admin search status reports a missing active index as degraded with a rebuild required.docs/architecture/meilisearch-index.mdis new and holds the rules: what triggers a rebuild, how searches behave while settings are pending, which keyword hits are kept, and why people are a separate query.This is several related changes in one pull request, at the owner's request. It can be split along the three headings above if that reviews better.
Validation
gofmt,go mod tidy -diff,go build,go vet: clean.make lint-changed,make lint-router-recovery: 0 issues.make test-go: passes. Four packages unrelated to this change (api/handlers,backup,ebookconvert,uploads) fail under the test machine's group-writable umask and pass withumask 022.verify-playback-fixtures,verify-apiv2-web-types,verify-actionlint,verify-prometheus-rules.Evidence
Surface and build: native API
GET /api/v2/catalog, movies and series, on a test server running this branch against the index described above. "Before" ismainwith Meilisearch enabled.back to the future(movies)forest gumptom hanksdenis villeneuvescrubsheat(movies)inceptiondune 2021movie about a sharkA ranking-rule change was applied to the live index in 0.03 s with no rebuild. Hybrid search ran for all 31 multi-word searches in the test set (median 664 ms) where 9 of 28 ran before. A cancelled rebuild's partial index was deleted by the next run.
Risks
settings_fingerprintcolumn. The other moves a storedrebuild_task_queue_depthof 4 to 16; the setting has no web control, so a stored 4 is the seeded default.toy story -hanksused to drop every title crediting a Hanks; 11 of its 36 results now credit one, because the exclusion applies only to the attributes the keyword query searches. Not fixed here.denis villenuevestill finds his films,christopher nolendoes not.scrubsno longer lists Scrublands.lastmatching-strategy option reads "Drop trailing words until something matches"; searches of three or more words now usefrequency. The label needs asilo-translationschange, not made here.Checklist
AI Disclosure
search_diagnostics.fallback_reason, a rebuild whose advisory lock is lost can have its index deleted by another node, and a cursor search that hits a just-replaced index stays on PostgreSQL for that session.🤖 Generated with Claude Code
Note
Replace federated Meilisearch search with per-query multi-search and speed up index rebuilds
overviewandtaglinefields and addpopularity; the Meilisearch service derives its indexing-memory limit from container memory in the omnibus image.SearchMeilisearchSchemaVersionrises from 3 to 4, so existing indexes rebuild on first sync. Newsettings_fingerprintcolumn added tocatalog_search_index_stateby migration. Searches with below-floor meaning matches or exclusion-only queries now report keyword mode; keyword result windows may return fewer candidates due to the first-worse-match cutoff.Macroscope summarized 0e4a7d5.