mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-16 05:43:54 +03:00
[PR #9197] Implement full text search #12021
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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 return90 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
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>.ProviderIdsis in the FTS index. This means a search like the following will return the item of interest (if it exists):searchTerm=Tmdb%3D61575orsearchTerm=Tmdb+61575