File tree Expand file tree Collapse file tree 2 files changed +15
-0
lines changed
src/librustdoc/html/static/js Expand file tree Collapse file tree 2 files changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -1393,6 +1393,7 @@ function initSearch(rawSearchIndex) {
13931393 */
13941394 async function sortResults ( results , isType , preferredCrate ) {
13951395 const userQuery = parsedQuery . userQuery ;
1396+ const casedUserQuery = parsedQuery . original ;
13961397 const result_list = [ ] ;
13971398 for ( const result of results . values ( ) ) {
13981399 result . item = searchIndex [ result . id ] ;
@@ -1403,6 +1404,13 @@ function initSearch(rawSearchIndex) {
14031404 result_list . sort ( ( aaa , bbb ) => {
14041405 let a , b ;
14051406
1407+ // sort by exact case-sensitive match
1408+ a = ( aaa . item . name !== casedUserQuery ) ;
1409+ b = ( bbb . item . name !== casedUserQuery ) ;
1410+ if ( a !== b ) {
1411+ return a - b ;
1412+ }
1413+
14061414 // sort by exact match with regard to the last word (mismatch goes later)
14071415 a = ( aaa . word !== userQuery ) ;
14081416 b = ( bbb . word !== userQuery ) ;
Original file line number Diff line number Diff line change 1+ const EXPECTED = {
2+ 'query' : 'Copy' ,
3+ 'others' : [
4+ { 'path' : 'std::marker' , 'name' : 'Copy' } ,
5+ { 'path' : 'std::fs' , 'name' : 'copy' } ,
6+ ] ,
7+ }
You can’t perform that action at this time.
0 commit comments