Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search inconsistency #250

Closed
IevgenSobko opened this issue May 1, 2021 · 8 comments
Closed

Search inconsistency #250

IevgenSobko opened this issue May 1, 2021 · 8 comments
Labels
Bug Something isn't working

Comments

@IevgenSobko
Copy link
Contributor

IevgenSobko commented May 1, 2021

The search field doesn't work as I expect.
For instance, I have the torrent that starts with True Gift.

When I type True in the filter field I am getting the following
2021-05-01__11-19-58
From what I see only last item contains the word True and I would expect only it to be displayed.
Or maybe it uses some fuzzy search with some mistyping allowance so it finds additional items?

@WDaan
Copy link
Collaborator

WDaan commented May 1, 2021

Screenshot 2021-05-01 at 11 11 37

Yes, the search uses Fuse.js with a fuzzy matching threshold of 0.3 on the properties listed above. I have little control over what gets matched an what doesn't. I can tweak the threshold a little bit.

@IevgenSobko
Copy link
Contributor Author

IevgenSobko commented May 1, 2021

Ooops, and my second comment not relevant cause I didn't manage to see the correct torrent name (especially second word).

Lets try to lower threshold to get better matching.
Plus there is a distance option that we can use with lower values like 2-5 to not allow matching to search too far away in a string.

I'll try to play with configuration later if manage to merge with upstream.

@IevgenSobko
Copy link
Contributor Author

The current search is a little bit too wide.
If I search Road and have category named Downloads it is matching every torrent from this category(about 74).
Because Downloads contains the last 3 letters of Road and almost all torrents somewhere in mentioned searched fields have the letter R.

@WDaan WDaan added Bug Something isn't working enhancement labels May 1, 2021
@IevgenSobko
Copy link
Contributor Author

IevgenSobko commented May 2, 2021

@WDaan I have played with different options to better understand algorithm and found out that 0.25 threshold works for my needs and I think for most users needs as well

      const options = {
        threshold: 0.25,
        shouldSort: false,
        keys: ['name', 'size', 'state', 'hash', 'savePath', 'tags', 'category']
      } 

Learned a lot about the algorithm and found out that all my above assumptions were wrong and distance actually represents how far from the location parameter it will match. But it also interconnected with the threshold parameter that is multiplied by distance to calculate the real limit.

So in this case we have 0,25 * 100*(default distance) = 25 characters from 0(default location) position in a string.
I think it is ok for most torrent names.

Also double-checked hash to make sure its 40 character length won't be ignored by this 25 characters from 0 position. And it seems to work ok for me. So these 25 characters represent the initial position of the match and if a matched part in a string exceeds 25 but matched starting position is within [0, 25] range it will match the whole searched word.

The only worry I have is savePath if it is too long... For me it works because I have shorter paths like /mnt/DATA/TVShows

As a result of all stated above could you pls apply a new threshold in the next release?

WDaan added a commit that referenced this issue May 2, 2021
@WDaan
Copy link
Collaborator

WDaan commented May 2, 2021

Thanks for the detailed analysis, I'll make a release with the tweaked value 🙂

@WDaan WDaan closed this as completed May 2, 2021
@IevgenSobko
Copy link
Contributor Author

IevgenSobko commented May 2, 2021

Wait a sec I have noticed that torrent card double click doesn't work anymore in master.
Do u see the same behavior?

@m4ximuel
Copy link
Contributor

m4ximuel commented May 2, 2021

@IevgenSobko It's my mistake, I fixed it on #249

@WDaan
Copy link
Collaborator

WDaan commented May 2, 2021

There are also some console.log statements, my bad for not checking thoroughly enough.
But those doesn't matter that much though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants