Skip to content

Commit 6aef531

Browse files
authored
Merge pull request #2576 from galaxyproject/fix-filter
[Tutorial Search] modify filter
2 parents 7b17c5e + fb6a118 commit 6aef531

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

search.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ title: Search Tutorials
1414
<!-- Configuration -->
1515
<script>
1616
var tutorials = { {% for topic in site.data %}
17-
{% if topic[0] == 'use' or topic[0] == 'admin-dev' or topic[0]=='basics' %}
17+
{% if topic[1].type == 'use' or topic[1].type == 'admin-dev' or topic[1].type == 'basics' %}
1818
{% assign topic_material = site.pages | topic_filter:topic[0] %}
1919
{% assign topic_title = topic[1].title %}
2020
{% for tutorial in topic_material %}
@@ -62,11 +62,13 @@ var tutorials = { {% for topic in site.data %}
6262

6363

6464
function search(idx, q){
65-
var results = idx.search(`*${q}*`).map(x => {
66-
return tutorials['/' + x.ref.replaceAll(".md", ".html")];
67-
}).filter(x => x !== undefined);
65+
if(q.length > 2){
66+
var results = idx.search(`*${q}*`).map(x => {
67+
return tutorials['/' + x.ref.replaceAll(".md", ".html")];
68+
}).filter(x => x !== undefined);
6869

69-
$("#results-container").html(results.map(x => x.entry));
70+
$("#results-container").html(results.map(x => x.entry));
71+
}
7072
}
7173

7274
fetch('{{ site.baseurl }}/search.json')

0 commit comments

Comments
 (0)