File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
src/librustdoc/html/static/js Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -3639,7 +3639,7 @@ class DocSearch {
3639
3639
if ( contains . length === 0 ) {
3640
3640
return 0 ;
3641
3641
}
3642
- const maxPathEditDistance = Math . floor (
3642
+ const maxPathEditDistance = parsedQuery . literalSearch ? 0 : Math . floor (
3643
3643
contains . reduce ( ( acc , next ) => acc + next . length , 0 ) / 3 ,
3644
3644
) ;
3645
3645
let ret_dist = maxPathEditDistance + 1 ;
@@ -3650,7 +3650,9 @@ class DocSearch {
3650
3650
let dist_total = 0 ;
3651
3651
for ( let x = 0 ; x < clength ; ++ x ) {
3652
3652
const [ p , c ] = [ path [ i + x ] , contains [ x ] ] ;
3653
- if ( Math . floor ( ( p . length - c . length ) / 3 ) <= maxPathEditDistance &&
3653
+ if ( parsedQuery . literalSearch && p !== c ) {
3654
+ continue pathiter;
3655
+ } else if ( Math . floor ( ( p . length - c . length ) / 3 ) <= maxPathEditDistance &&
3654
3656
p . indexOf ( c ) !== - 1
3655
3657
) {
3656
3658
// discount distance on substring match
You can’t perform that action at this time.
0 commit comments