[PR #12488] [CLOSED] Update SearchHint.cs #13218

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

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/12488
Author: @Nodebaron
Created: 8/21/2024
Status: Closed

Base: masterHead: patch-2


📝 Commits (1)

📊 Changes

1 file changed (+24 additions, -186 deletions)

View changed files

📝 MediaBrowser.Model/Search/SearchHint.cs (+24 -186)

📄 Description

The CalculateLevenshteinDistance method enhances the Jellyfin search functionality by introducing fuzzy matching capabilities. This allows the search feature to return relevant results even when users make small errors in their search queries, such as typos or minor spelling differences, thereby improving the accuracy and usability of the search system.

Problem it Addresses:
Typos and Misspellings:

When users search for items (like movies, songs, or books) in a media library, they might accidentally mistype a word. For example, instead of typing "Harry Potter," a user might type "Hrry Ptter." Traditional search methods that rely on exact matches would fail to return the correct result.
Variations in Input:

Users might also use variations of a name or title that differ slightly from the stored version. For example, "Star Wars Episode 4" vs. "Star Wars: Episode IV." Without fuzzy matching, these variations might not yield the expected results.
User Experience Improvement:

By implementing fuzzy matching, the search system becomes more forgiving, improving the user experience by returning relevant results even when the input is not perfectly accurate.
What the Levenshtein Distance Does:
Levenshtein Distance:

This is a measure of how different two strings are by counting the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one word into the other.
For example, the Levenshtein distance between "kitten" and "sitting" is 3 (substitute 'k' with 's', substitute 'e' with 'i', and add 'g' at the end).
Application in Search:

By calculating the Levenshtein distance between the user’s search query and the names of media items, you can determine how closely they match. The lower the distance, the more similar the terms are.
This allows the search function to find items that are "close" to what the user typed, even if it's not an exact match.
How It Solves the Problem:
Enhances Search Results:

With this method, the search function can now return results that are close matches, rather than just exact matches. This is particularly useful in large media libraries where users may not remember exact titles or may type quickly, resulting in typos.
Improves User Satisfaction:

By ensuring that the search function can handle minor errors in user input, you reduce the number of "no results found" errors, thereby improving overall user satisfaction with the application.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jellyfin/jellyfin/pull/12488 **Author:** [@Nodebaron](https://github.com/Nodebaron) **Created:** 8/21/2024 **Status:** ❌ Closed **Base:** `master` ← **Head:** `patch-2` --- ### 📝 Commits (1) - [`6874e71`](https://github.com/jellyfin/jellyfin/commit/6874e71ac90d449129ef5cd278a7045023f234da) Update SearchHint.cs ### 📊 Changes **1 file changed** (+24 additions, -186 deletions) <details> <summary>View changed files</summary> 📝 `MediaBrowser.Model/Search/SearchHint.cs` (+24 -186) </details> ### 📄 Description The CalculateLevenshteinDistance method enhances the Jellyfin search functionality by introducing fuzzy matching capabilities. This allows the search feature to return relevant results even when users make small errors in their search queries, such as typos or minor spelling differences, thereby improving the accuracy and usability of the search system. Problem it Addresses: Typos and Misspellings: When users search for items (like movies, songs, or books) in a media library, they might accidentally mistype a word. For example, instead of typing "Harry Potter," a user might type "Hrry Ptter." Traditional search methods that rely on exact matches would fail to return the correct result. Variations in Input: Users might also use variations of a name or title that differ slightly from the stored version. For example, "Star Wars Episode 4" vs. "Star Wars: Episode IV." Without fuzzy matching, these variations might not yield the expected results. User Experience Improvement: By implementing fuzzy matching, the search system becomes more forgiving, improving the user experience by returning relevant results even when the input is not perfectly accurate. What the Levenshtein Distance Does: Levenshtein Distance: This is a measure of how different two strings are by counting the minimum number of single-character edits (insertions, deletions, or substitutions) required to change one word into the other. For example, the Levenshtein distance between "kitten" and "sitting" is 3 (substitute 'k' with 's', substitute 'e' with 'i', and add 'g' at the end). Application in Search: By calculating the Levenshtein distance between the user’s search query and the names of media items, you can determine how closely they match. The lower the distance, the more similar the terms are. This allows the search function to find items that are "close" to what the user typed, even if it's not an exact match. How It Solves the Problem: Enhances Search Results: With this method, the search function can now return results that are close matches, rather than just exact matches. This is particularly useful in large media libraries where users may not remember exact titles or may type quickly, resulting in typos. Improves User Satisfaction: By ensuring that the search function can handle minor errors in user input, you reduce the number of "no results found" errors, thereby improving overall user satisfaction with the application. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-07 07:09:09 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#13218