advplyr / audiobookshelf

Self-hosted audiobook and podcast server
https://audiobookshelf.org
GNU General Public License v3.0
6.23k stars 435 forks source link

[Enhancement]: Fuzzy search library #1401

Open hobesman opened 1 year ago

hobesman commented 1 year ago

Describe the feature/enhancement

When searching my library, I would like search results containing the same words to show as match results. In my library I have a book called "Fancy Nancy's Splendiferous Christmas" which shows up if I search Christmas, but does not appear if I search "Fancy Christmas" within my library.

Could search be made to look for matches containing "Fancy Christmas" OR ("fancy" AND "christmas") OR "Fancy" OR "Christmas" The results could contain all of those, but prioritized in that order based on which term they match. That way "Fancy Christmas Recipes" is listed first (exact string match), then Fancy Nancy's Splendiferous Christmas (multi-word match), then Fancy Styles and Trends, and finally A Christmas Carol (single word matches).

It would get more complicated with multi-word searches but I imagine some sort of logic already exists that could be applied?

hobesman commented 1 year ago

Just thinking this through, the searches could be conducted in reverse order, starting with all the results matching any of the terms, then search among those for results matching all of the terms and put those at the top, then search among those for results matching the entire string and put those at the top. That way you're not searching the entire library anymore after compiling matches for each term. Just an idea.

FerriteGiant commented 1 year ago

I'd like to expand this request into full fuzzy search capabilities

leeoniya commented 1 year ago

shameless plug: https://github.com/leeoniya/uFuzzy#a-biased-appraisal-of-similar-work

DirkIngo commented 1 month ago

This should also include chapter names. Would be a nice side effect for using abs for music. But Im not sure if single chapters can be displayed as a search result but a result for the album/audiobook would be good enough I guess.