Skip to content

Commit 3423a8b

Browse files
committed
assume no explicit query string means filterTutorials
1 parent 9ebda28 commit 3423a8b

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

tutorials/themes/tutorials-theme/static/searchtools.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -337,9 +337,12 @@ var Search = {
337337
var params = $.getQueryParameters();
338338
if (params.q) {
339339
var query = params.q[0];
340-
$('input[name="q"]')[0].value = query;
341-
this.performSearch(query);
340+
} else {
341+
// If no query string is passed, assume we want to filterTutorials
342+
var query = "filterTutorials";
342343
}
344+
$('input[name="q"]')[0].value = query;
345+
this.performSearch(query);
343346
},
344347

345348
loadIndex : function(url) {
@@ -410,7 +413,7 @@ var Search = {
410413
this.deferQuery(query);
411414

412415
//Perform search in Astropy Documentation
413-
if(window.location.search.search("filterTutorials")==-1){ //if filtered by tutorials, then no need to search in Astropy Documentation
416+
if (query.includes("filterTutorials")) { // don't search docs if we are just looking for tutorials
414417
var docResponse = null;
415418
var docResult = '';
416419
$.get('https://readthedocs.org/api/v2/docsearch/?q=' + window.location.search.split('=')[1] + '&project=astropy&version=stable&language=en', function(response){

0 commit comments

Comments
 (0)