rust-lang / crates.io

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

Return search results for partial matches #159

Closed eminence closed 5 years ago

eminence commented 9 years ago

When you search for ssh you get the following results:

When you search for 'libssh' you get the following results:

When you search for libssh2 you get the following results:

With the exception of 'fleet' I expected to see all 3 results when I search for just "ssh". It seems as if the search text is being matched only on the description and not the package name?

DanielKeep commented 9 years ago

I just wasted hours writing a crate that already existed because "tempfile" doesn't show up when you search for "temp" or "file".

azerupi commented 9 years ago

I could be wrong, but think that at the moment crates are only returned on exact match with keywords, crate name or full words in the description.

If partial matches were returned too, it would already solve a lot of issues. If you search for book you get 6 results, but if you search for boo you get nothing.

Also I think an exact match with the crate name should appear as the very first result.

AlisdairO commented 9 years ago

Could use a little influence from number of downloads as well - arguably if you search for 'random' you'd probably want the 'rand' crate at least appearing in the top two results. It's number 4 at the moment (so clearly not too bad!), but one could imagine other situations in which this would be worse, particularly as the number of crates grows.

I might see if I can find some time to take a look at search.

nodakai commented 8 years ago

@eminence It is working for you now?

$ cargo search ssh
    Updating registry `https://github.com/rust-lang/crates.io-index`
ssh (0.1.4)         Bindings to libssh, a library to write clients and servers for both version 1 and 2 of the protocol. It can also parse SSH conf…
mush (0.1.1)        Bindings to libssh2 for interacting with SSH servers and executing remote commands, forwarding local ports, etc. 
ssh2 (0.2.11)       Bindings to libssh2 for interacting with SSH servers and executing remote commands, forwarding local ports, etc. 
actiondb (0.6.1)    A safe and efficient unstructured text (log) parsing library.
fleet (0.2.0)       A client library for CoreOS's fleet.
$ cargo search libssh
    Updating registry `https://github.com/rust-lang/crates.io-index`
libssh (0.0.1)    bindings for libssh
ssh (0.1.4)       Bindings to libssh, a library to write clients and servers for both version 1 and 2 of the protocol. It can also parse SSH conf…
$ cargo search libssh2
    Updating registry `https://github.com/rust-lang/crates.io-index`
libssh2-sys (0.1.36)    Native bindings to the libssh2 library
ssh2 (0.2.11)           Bindings to libssh2 for interacting with SSH servers and executing remote commands, forwarding local ports, etc. 
mush (0.1.1)            Bindings to libssh2 for interacting with SSH servers and executing remote commands, forwarding local ports, etc. 

ssh 0.1.4 Bindings to libssh, a library to write clients and servers for both version 1 and 2 of the protocol. It can also parse SSH config files and handle ProxyCommand automatically. Only the client part is i ...

mush 0.1.1 Bindings to libssh2 for interacting with SSH servers and executing remote commands, forwarding local ports, etc.

ssh2 0.2.11 Bindings to libssh2 for interacting with SSH servers and executing remote commands, forwarding local ports, etc.

actiondb 0.6.1 A safe and efficient unstructured text (log) parsing library.

fleet 0.2.0 A client library for CoreOS's fleet.

libssh 0.0.1 bindings for libssh

ssh 0.1.4 Bindings to libssh, a library to write clients and servers for both version 1 and 2 of the protocol. It can also parse SSH config files and handle ProxyCommand automatically. Only the client part is i ...

libssh2-sys 0.1.36 Native bindings to the libssh2 library

ssh2 0.2.11 Bindings to libssh2 for interacting with SSH servers and executing remote commands, forwarding local ports, etc.

mush 0.1.1 Bindings to libssh2 for interacting with SSH servers and executing remote commands, forwarding local ports, etc.

@DanielKeep And for you?

$ cargo search temp
    Updating registry `https://github.com/rust-lang/crates.io-index`
temp_utp (0.7.2)               A µTP (Micro/uTorrent Transport Library) library implemented in Rust
mkstemp (0.2.0)                A quick mkstemp/mkdtemp implementation for rust. Provides temp files and dirs.
java-properties (0.1.1)        A library for reading and writing Java properties files in Rust.
azure_sdk_for_rust (0.1.3)     Rust wrappers around Microsoft Azure REST APIs
schemamama_postgres (0.0.8)    PostgreSQL adapter for the Schemamama migration system
$ cargo search file
    Updating registry `https://github.com/rust-lang/crates.io-index`
file_diff (0.2.0)            An atomic utility for diffing files in testing
clap (2.1.1)                 A simple to use, efficient, and full featured  Command Line Argument Parser
librsync (0.1.2)             Bindings to librsync for calculating and applying network deltas exposed as Reader/Writer streams. 
file_logger (0.1.0)          A simple logger backend that outputs to a file.  This is alpha state.
doc_file (0.2.0)             Move your Rust crate's documentation into external files. 
xsv (0.9.11)                 A high performance CSV command line toolkit.
tar (0.4.3)                  A Rust implementation of a TAR file reader and writer. This library does not currently handle compression, but it is abstract o…
vault (1.0.0)                A parser for Company of Heroes 2 replay files. Valid for replays generated since UKF release (version 19545).
yaml_file_handler (0.1.4)    A Yaml File Handler based on yaml-rust
caribon (0.7.1)              A repetition detector program and library

temp_utp 0.7.2 A µTP (Micro/uTorrent Transport Library) library implemented in Rust

mkstemp 0.2.0 A quick mkstemp/mkdtemp implementation for rust. Provides temp files and dirs.

java-properties 0.1.1 A library for reading and writing Java properties files in Rust.

azure_sdk_for_rust 0.1.3 Rust wrappers around Microsoft Azure REST APIs

schemamama_postgres 0.0.8 PostgreSQL adapter for the Schemamama migration system

Displaying 1-10 of 510 total results

file_diff 0.2.0 An atomic utility for diffing files in testing

clap 2.1.1 A simple to use, efficient, and full featured Command Line Argument Parser

librsync 0.1.2 Bindings to librsync for calculating and applying network deltas exposed as Reader/Writer streams.

file_logger 0.1.0 A simple logger backend that outputs to a file. This is alpha state.

doc_file 0.2.0 Move your Rust crate's documentation into external files.

xsv 0.9.11 A high performance CSV command line toolkit.

tar 0.4.3 A Rust implementation of a TAR file reader and writer. This library does not currently handle compression, but it is abstract over all I/O readers and writers. Additionally, great lengths are taken to ...

vault 1.0.0 A parser for Company of Heroes 2 replay files. Valid for replays generated since UKF release (version 19545).

yaml_file_handler 0.1.4 A Yaml File Handler based on yaml-rust

caribon 0.7.1 A repetition detector program and library

But the results from cargo search file is super confusing because it doesn't say it truncated the list of matches by the first 10. I had the same problem with cargo search time. I'm filing another ticket on it.

DanielKeep commented 8 years ago

@nodakai Well, no; temp doesn't show tempfile, and file has too many results now to be useful, even if the results might contain tempfile (I gave up checking around result number 110).

nodakai commented 8 years ago

I see, so you're saying this package should have been found with the search for temp:

Yeah everyone would expect so.

I believe these SQL queries should be improved:

sgrif commented 5 years ago

This was fixed by #1560