npmsearch icon indicating copy to clipboard operation
npmsearch copied to clipboard

How does npmsearch.com do sorting?

Open pketh opened this issue 9 years ago • 2 comments

The closest I've been able to get is with sort=rating:desc http://npmsearch.com/query?q=async&fields=name,description,version,keywords,homepage&size=15&sort=rating:desc, but if you compare the results with http://npmsearch.com/?q=async, the site search returns much better results.

How are searches sorted by the site? Thanks

pketh avatar Jan 26 '16 18:01 pketh

It seems like keywords are being weighted more than the actual package name?

pketh avatar Jan 26 '16 18:01 pketh

in server.js I see the request body is

  var body = {
    fields: ['name','description','keywords','author','modified','homepage','version','license','rating'],
    query: search,
    sort: [{'rating' : "desc"}],
    highlight: {
      fields: {
        description : {}
      }
    }
  };

but I'm not seeing the difference still

pketh avatar Jan 27 '16 04:01 pketh