@@ -1058,14 +1058,14 @@ window.initSearch = function(rawSearchIndex) {
10581058 return "<button>" + text + " <div class=\"count\">(" + nbElems + ")</div></button>" ;
10591059 }
10601060
1061- function showResults ( results ) {
1061+ function showResults ( results , go_to_first ) {
10621062 var search = searchState . outputElement ( ) ;
1063- if ( results . others . length === 1
1063+ if ( go_to_first || ( results . others . length === 1
10641064 && getSettingValue ( "go-to-only-result" ) === "true"
10651065 // By default, the search DOM element is "empty" (meaning it has no children not
10661066 // text content). Once a search has been run, it won't be empty, even if you press
10671067 // ESC or empty the search input (which also "cancels" the search).
1068- && ( ! search . firstChild || search . firstChild . innerText !== searchState . loadingText ) )
1068+ && ( ! search . firstChild || search . firstChild . innerText !== searchState . loadingText ) ) )
10691069 {
10701070 var elem = document . createElement ( "a" ) ;
10711071 elem . href = results . others [ 0 ] . href ;
@@ -1242,7 +1242,7 @@ window.initSearch = function(rawSearchIndex) {
12421242 }
12431243
12441244 var filterCrates = getFilterCrates ( ) ;
1245- showResults ( execSearch ( query , index , filterCrates ) ) ;
1245+ showResults ( execSearch ( query , index , filterCrates ) , params . go_to_first ) ;
12461246 }
12471247
12481248 function buildIndex ( rawSearchIndex ) {
0 commit comments