[PR #9197] Implement full text search #12021

Closed
opened 2026-02-07 06:48:38 +03:00 by OVERLORD · 0 comments
Owner

Original Pull Request: https://github.com/jellyfin/jellyfin/pull/9197

State: closed
Merged: No


Changes
This implements a true full text search using sqlite's built in fts5 extension. Currently, jellyfin is trying to implement full text search by doing some sql trickery, but it doesn't support things like keyword searches. For example, it doesn't support a search like 90 day what now, which in a FTS would return 90 Day Fiancé - What Now! (2017).

This new implementation supports FTS with three different search types, of which one can be specified by the client: Phrase, Prefix, and Keyword. It defaults to Prefix, which makes it backwards compatible with the existing search. In addition, this implementation is using the Porter tokenizer, which implements the Porter stemming algorithm. (EDIT: I took out the Porter tokenizer. It can give confusing results.) The fts5 extension provides a rank for each search so the results are returned in rank order.

This should require no intervention on the user's part. On startup, the user's FTS index is seeded automatically if their index is empty. Real time FTS index updates are achieved using db triggers.

Two changes were made from the existing search

  1. Tags are not included in the FTS index. It doesn't make sense to include it because a FTS plus tag search can be done as follows: searchTerm=<search term>&tags=<tags>.

  2. ProviderIds is in the FTS index. This means a search like the following will return the item of interest (if it exists): searchTerm=Tmdb%3D61575 or searchTerm=Tmdb+61575

**Original Pull Request:** https://github.com/jellyfin/jellyfin/pull/9197 **State:** closed **Merged:** No --- **Changes** This implements a true full text search using sqlite's built in fts5 extension. Currently, jellyfin is trying to implement full text search by [doing some sql trickery](https://github.com/jellyfin/jellyfin/blob/fec23de427fe1c46e4ce1aaf31f1695c90232059/Emby.Server.Implementations/Data/SqliteItemRepository.cs#L2427), but it doesn't support things like keyword searches. For example, it doesn't support a search like `90 day what now`, which in a FTS would return `90 Day Fiancé - What Now! (2017)`. This new implementation supports FTS with three different search types, of which one can be specified by the client: Phrase, Prefix, and Keyword. It defaults to Prefix, which makes it backwards compatible with the existing search. ~~In addition, this implementation is using the Porter tokenizer, which implements the [Porter stemming algorithm](https://tartarus.org/martin/PorterStemmer/)~~. (EDIT: I took out the Porter tokenizer. It can give confusing results.) The fts5 extension provides a rank for each search so the results are returned in rank order. This should require no intervention on the user's part. On startup, the user's FTS index is seeded automatically if their index is empty. Real time FTS index updates are achieved using db triggers. Two changes were made from the existing search 1) Tags are not included in the FTS index. It doesn't make sense to include it because a FTS plus tag search can be done as follows: `searchTerm=<search term>&tags=<tags>`. 2) `ProviderIds` is in the FTS index. This means a search like the following will return the item of interest (if it exists): `searchTerm=Tmdb%3D61575` or `searchTerm=Tmdb+61575`
OVERLORD added the pull-request label 2026-02-07 06:48:38 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#12021