Skip to content

Commit

Permalink
Merge pull request #2576 from galaxyproject/fix-filter
Browse files Browse the repository at this point in the history
[Tutorial Search] modify filter
  • Loading branch information
shiltemann authored May 31, 2021
2 parents 7b17c5e + fb6a118 commit 6aef531
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions search.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ title: Search Tutorials
<!-- Configuration -->
<script>
var tutorials = { {% for topic in site.data %}
{% if topic[0] == 'use' or topic[0] == 'admin-dev' or topic[0]=='basics' %}
{% if topic[1].type == 'use' or topic[1].type == 'admin-dev' or topic[1].type == 'basics' %}
{% assign topic_material = site.pages | topic_filter:topic[0] %}
{% assign topic_title = topic[1].title %}
{% for tutorial in topic_material %}
Expand Down Expand Up @@ -62,11 +62,13 @@ var tutorials = { {% for topic in site.data %}


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

$("#results-container").html(results.map(x => x.entry));
$("#results-container").html(results.map(x => x.entry));
}
}

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

0 comments on commit 6aef531

Please sign in to comment.