ReVanced / revanced-website

🌐 Website for ReVanced
https://revanced.app
GNU General Public License v3.0
279 stars 43 forks source link

feat: Add fuzzy search to patches search #229

Closed Ushie closed 2 months ago

cloudflare-pages[bot] commented 3 months ago

Deploying with  Cloudflare Pages  Cloudflare Pages

Latest commit: c4c4055
Status:🚫  Build failed.

View logs

PalmDevs commented 3 months ago

Someone fix deploying, I want to see a preview.

revanced-bot commented 3 months ago

Deployed at https://head.revanced.pages.dev.

revanced-bot commented 3 months ago

Deployed at https://d455e42c.revanced.pages.dev.

xafn commented 3 months ago

this ALMOST LGTM. the only thing is that for some reason if you clear the search string, the parameter in the url doesn't clear. if nobody figures out why this happens by tonight i'll try to fix this.

resolved in #230

revanced-bot commented 3 months ago

Deployed at https://987be635.revanced.pages.dev.

oSumAtrIX commented 3 months ago

image

I am not sure what kind of parameters cause this, but if i search for video ads, it should not show other results present here

KTibow commented 3 months ago

that's what happens when you have both "adds" and "video" in the description of a patch. now that normally wouldn't be a problem, but the ones that actually have "video ads" in the title are being downranked. that will have to be fixed...

KTibow commented 3 months ago

https://3f823d90.revanced.pages.dev/patches?s=video+ads

oSumAtrIX commented 3 months ago

Can a threshold be used? This way results with a low threshold, weighted down by results with high matches can be hidden

oSumAtrIX commented 2 months ago
image

Some threshold needs to be adjusted, too many irrelevant results or incorrect ones show up

KTibow commented 2 months ago

@oSumAtrIX I just checked, and the exact same first search results show up on the non-fuzzy version. I think it's worth deploying now, as it makes some situations better without making any worse.

oSumAtrIX commented 2 months ago

If you scroll down on the fizzy search you will find many results that hardly match the search, the thresholds may be adjusted for that. The fuzzy search should slightly aid the search on variations of searches such as spelling mistakes, casing, spaces or characters, and not match results that are hardly expected to show up.

KTibow commented 2 months ago

Well that's a tough one. I see a couple options to add a minimum score:

Which one would you prefer?

oSumAtrIX commented 2 months ago

The first and last option are the only reasonable ones

KTibow commented 2 months ago

FYI looks like someone already tried to contribute scores and it hasn't been merged: https://github.com/wouterrutgers/fuzzy-search/pull/82/files If inlining is still out as an option, we'll have to switch to another library like Fuse. Fuse doesn't have the smallest bundle size (15kb bundled uncompressed, since it uses classes) but it's popular and would work.

oSumAtrIX commented 2 months ago

If there is a fork already, we can use it if it is rebased on upstream (use a commit hash for the dependency and link the PR)

oSumAtrIX commented 2 months ago

Instead of fuze due to its size you should use the fork

KTibow commented 2 months ago

I notice Fuse providing more relevant results, so I think we should use it anyway. It's only a 4kb increase from the previous library over the wire.

Without Fuse: Screenshot 2024-04-27 at 07-37-13 ReVanced - Patches for ReVanced With Fuse: Screenshot 2024-04-27 at 07-36-45 ReVanced - Patches for ReVanced

oSumAtrIX commented 2 months ago

Why does Fuse show different results though? Isn't the algorithm the same?

KTibow commented 2 months ago

No, not all fuzzy search algorithms are the same. I haven't checked all the differences, but the most useful thing I see fuse doing is relying on shorter fields (eg title) more than longer fields.