verdaccio / verdaccio

📦🔐 A lightweight Node.js private proxy registry
https://www.verdaccio.org/
MIT License
16.26k stars 1.37k forks source link

Bug: exact search phrase does not work #1632

Closed DanielRuf closed 3 years ago

DanielRuf commented 4 years ago

Describe the bug When searching for jquer the search API correctly returns jquery. If we input jquery it returns an empty array and so the search suggestions are also empty in the UI.

To Reproduce Search for jquery and jquery. See the responses in the network tab.

Steps to reproduce the behavior:

  1. Go to verdaccio frontend
  2. Input jquer
  3. Check results
  4. Input jquery
  5. Check results

Expected behavior A direct match should return the packages.

Screenshots

Bildschirmfoto 2019-12-25 um 15 39 55 Bildschirmfoto 2019-12-25 um 15 39 46
nair-sreerag commented 4 years ago

This is an issue with the stemmer of the lunr package; on which the package - lunr-mutable-indexes (used in this project) is based. I published jquery and commander to my local verdaccio instance. The issue occured in both the cases (for the word jquery as mentioned above and for the words commande and commander). Here's the link to the issue in lunr package - issue 38 Lunr uses some stemming algorithm (quite possibly Porter Stemming) to stem the inserted words while indexing. It stems commander to command and jquery to jqueri before indexing. Try inputting those exact words in the verdaccio search bar. It should return the original package name.

juanpicado commented 4 years ago

Thanks for the feedback @nair-sreerag, you are right, but unfortunately the link you have provided has been detected as malware, please, remove that link or I'll be forced to remove your comment in the next 48 hours.

nair-sreerag commented 4 years ago

which link are you talking about?

juanpicado commented 4 years ago

The point 1. That's the unique problem. Sorry, that's what my antivirus is suggesting. I have no issues with the other content which I fully agree.

nair-sreerag commented 4 years ago

Its weird. Anyways, can u try this one [xxxx] I'll remove this comment after u approve this website.

The site is not exactly malware, but its Apache version is old. Hence, it is being flagged as vulnerable by avs.

juanpicado commented 4 years ago

I don't see a reason to post more links ( I won't click on it), that's not need it.

If you want to share content, the best way is sharing a repo where user can see what's behind he hood. And please, be kind and don't post more links.

cc: @DanielRuf

nair-sreerag commented 4 years ago

Okies. I'll edit the comment in a different way so that the user can reproduce the issue. Thanks :)

Regards, Sreerag Nair

DanielRuf commented 4 years ago

The link was detected as malware because it references / loads a bitcoin miner script from coin-hive in the source code but the website of bitcoin-hive was shut down / is offline.

You can see it with view-source:the-url

DanielRuf commented 4 years ago

I think the link to https://github.com/olivernn/lunr.js/issues/38 is sufficient, which also includes a possible solution.

No need to show different stemmer implementations.

The code from the jssnowball demo is at https://github.com/mazko/jssnowball/tree/master and https://github.com/mazko/jssnowball/tree/gh-pages

nair-sreerag commented 4 years ago

Thanks for explaining what exactly the issue was with the link, @DanielRuf. I will refrain from posting links of anything other than github in the future. And also, I have edited my comment, @juanpicado .

juanpicado commented 4 years ago

Thanks @nair-sreerag , thanks for having such nice attitude 👏 and document properly your feedback .