]> git.lizzy.rs Git - rust.git/commit
rustdoc: Better sorting criteria for searching.
authorKang Seonghoon <public+git@mearie.org>
Mon, 14 Apr 2014 18:39:59 +0000 (03:39 +0900)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 16 Apr 2014 02:45:00 +0000 (19:45 -0700)
commit326f938730c1eaae48ed333907dce2cc92dc9aab
tree535d8680b57c46a97ece228b50c23713aa9fb584
parentea5d9088ad36d08671a5ac77697e9ba7f4340b1a
rustdoc: Better sorting criteria for searching.

This essentially rewrites the sorting algorithm, which relied on
the implementation-defined handling of non-consistent sorting function
(cf. ECMA-262 5th edition, section 15.4.4.11)
and was also a bit inefficient.

The new criteria expands the prior criteria while adding these ones:

- The current crate is always preferred over other crates.
  (Closes #13178)
- An item with a description is preferred over one without it,
  if item names match. This is a heuristic assuming that
  the documented item is more likely to be relevant.
- An item with no literal occurrence of search query is handled correctly.
src/librustdoc/html/static/main.js