File tree Expand file tree Collapse file tree 1 file changed +7
-12
lines changed
src/librustdoc/html/static Expand file tree Collapse file tree 1 file changed +7
-12
lines changed Original file line number Diff line number Diff line change 681
681
}
682
682
683
683
function checkPath ( startsWith , lastElem , ty ) {
684
+ if ( startsWith . length === 0 ) {
685
+ return 0 ;
686
+ }
684
687
var ret_lev = MAX_LEV_DISTANCE + 1 ;
685
688
var path = ty . path . split ( "::" ) ;
686
689
706
709
lev_total += lev ;
707
710
}
708
711
if ( aborted === false ) {
709
- var extra = MAX_LEV_DISTANCE + 1 ;
710
- if ( i + startsWith . length < path . length ) {
711
- extra = levenshtein ( path [ i + startsWith . length ] , lastElem ) ;
712
- }
713
- if ( extra > MAX_LEV_DISTANCE ) {
714
- extra = levenshtein ( ty . name , lastElem ) ;
715
- }
716
- if ( extra < MAX_LEV_DISTANCE + 1 ) {
717
- lev_total += extra ;
718
- ret_lev = Math . min ( ret_lev ,
719
- Math . round ( lev_total / ( startsWith . length + 1 ) ) ) ;
720
- }
712
+ ret_lev = Math . min ( ret_lev , Math . round ( lev_total / startsWith . length ) ) ;
721
713
}
722
714
}
723
715
return ret_lev ;
934
926
}
935
927
936
928
lev += lev_add ;
929
+ if ( searchWords [ j ] . startsWith ( val ) ) {
930
+ lev -= 1 ;
931
+ }
937
932
if ( in_args <= MAX_LEV_DISTANCE ) {
938
933
if ( results_in_args [ fullId ] === undefined ) {
939
934
results_in_args [ fullId ] = {
You can’t perform that action at this time.
0 commit comments