amperfy icon indicating copy to clipboard operation
amperfy copied to clipboard

[Bug] Fuzzy search inconsistencies

Open bbsixzz opened this issue 1 year ago • 4 comments

The album is literally there, searching for Vaseline gives no results.

https://github.com/user-attachments/assets/8da8141d-d245-4e3e-b6a6-ca3e27ffb8bc

bbsixzz avatar Aug 22 '24 11:08 bbsixzz

Fuzzy search is implemented by the fuse-swift library which is unmaintained and archived.

However, I did find https://github.com/ukushu/Ifrit which is a fork of fuse-swift with several bug fixes. Changing the dependency should not require any code changes besides changing an import statement.

Maybe this is worth a try @BLeeEZ?

Schlaubischlump avatar Sep 09 '24 22:09 Schlaubischlump

I moved from fuse to Ifrit in 315b80f134fe8eda97bf8aa52b918372b5dc839f. Thank you for mentioning this. I wasn't able to reproduce this issue so I am not sure that this switch does fix the issue. Let's find out in the upcoming beta.

BLeeEZ avatar Sep 10 '24 18:09 BLeeEZ

Alright I guess the fix is not in iOS v1.2.2 (1) as it behaves the same.

bbsixzz avatar Sep 16 '24 23:09 bbsixzz

Ifrit is used in v1.2.2 (1). It seems that this did not fixed the issue.

BLeeEZ avatar Sep 17 '24 17:09 BLeeEZ

Just an update, these are some really weak results.

home agai gives both tracks I'm looking for:

Image

home again however only gives one result…

Image

bbsixzz avatar Mar 25 '25 03:03 bbsixzz

I researched a bit and I'm pretty sure your problems stem from this line in FuzzySearcher:

if let result = result, result.score <= Self.fuzzyMatchThreshold

Where fuzzyMatchThreshold is set to 0.2. If I for example search my music collection for Home Version, I get the following results:

score: 0.30333333333333334 :: Aisumasen (I'm Sorry) [Home Version]
score: 0.42333333333333334 :: Bring on the Lucie (Freda People) [Home Version]
score: 0.18333333333333335 :: Meat City [Home Version]

From these three results I only see Meat City, since this is the only one with a score below 0.2. I think the score is somehow based on the length of the string. Since both of your titles are long, the score is high.

I propose we change the code to remove the threshold completely. Since we are already sorting the results based on the score, the SearchVC will only display the prefix, that is the first (best) 10 results for each song / album / artist.

@BLeeEZ what do you think? Any particular reason why we need the threshold?

Schlaubischlump avatar Apr 16 '25 20:04 Schlaubischlump

@bbsixzz did this solve your problem? I think the fix should be in the latest testflight beta

Schlaubischlump avatar Apr 27 '25 15:04 Schlaubischlump

Yeah it's great!

bbsixzz avatar Apr 27 '25 20:04 bbsixzz