rust-lang / crates.io

The Rust package registry
https://crates.io
Apache License 2.0
2.96k stars 599 forks source link

The search is not weighting keywords enough #1161

Open TrionProg opened 6 years ago

TrionProg commented 6 years ago

Hello, I've found interesting behaviour of search.

For example, I have library, that uses keywords 'result' and 'error' https://crates.io/crates/nes

If you will search https://crates.io/search?q=result or https://crates.io/search?q=error , where will be crates like https://crates.io/crates/imagequant-sys or https://crates.io/crates/rustiful , those have no these keywords, and have nothing similar with search query, but NES library is at 2 page, therefore nobody knows it and it is upset.

I think, this is incorrect behaviour.

carols10cents commented 6 years ago

Thanks! We'll look into it. I don't think the search is ignoring keywords since nes is in the search results.

It looks like imagequant-sys is so high because its README contains "result" a lot. We could definitely do better to show why search results are returned, and we could certainly tweak the weighting of the various fields that are searched to make keyword matches more important.

For anyone interested in investigating this, here is where we define the tsvector that postgres uses for search.