Skip to content

Commit

Permalink
Limit rendering of search results to 50 items (#12)
Browse files Browse the repository at this point in the history
This speeds up page loads for large indexes.
  • Loading branch information
scudette authored Jan 15, 2024
1 parent 9ec708a commit a234857
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 11 deletions.
5 changes: 3 additions & 2 deletions docs/config.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
baseURL = 'http://sigma.velocidex.com/'
languageCode = 'en-us'
title = 'Velociraptor Sigma Rules'
title = 'Velociraptor Curated Sigma'

[module]
[[module.imports]]
path = 'github.com/alex-shpak/hugo-book'


[params]
BookTheme = 'light'
BookTheme = 'light'
BookSearch = false
1 change: 1 addition & 0 deletions docs/content/docs/indexes/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "Indexes"
date: 2023-10-15T00:14:44+10:00
weight: 20
---

# Search rule sets
Expand Down
1 change: 1 addition & 0 deletions docs/content/docs/sigma_in_velociraptor/_index.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
title: "Sigma In Velociraptor"
date: 2023-10-15T00:14:44+10:00
weight: 10
---

# Sigma In Velociraptor
Expand Down
24 changes: 15 additions & 9 deletions docs/layouts/shortcodes/ruleset.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@
</script>

<div class="input-group">
<input type="text" id="myInput" onkeyup="doSearch()" class="form-control" placeholder="Search rules" aria-describedby="basic-addon2">
<span class="input-group-addon" id="basic-addon2"><i class="fas fa-search"></i></span>
<input type="text" id="myInput" onkeyup="doSearch()"
class="form-control"
placeholder="Search rules"
aria-describedby="basic-addon2">
<span class="input-group-addon"
id="basic-addon2"><i class="fas fa-search"></i></span>
</div>

<hr />
Expand Down Expand Up @@ -54,11 +58,17 @@
DrawResults(result);
}

// Only show up to 50 hits to make the page load faster.
function DrawResults(data) {
$(".search_results").empty();
$(".search_results").empty();

for(let i=0;i<data.length; i++) {
let item = data[i];
let most_results = data.length;
if(most_results > 50) {
most_results = 50;
}

for(let i=0;i<most_results; i++) {
let item = data[i];
let template = $(`
<div class="panel panel-default color">
<div class="panel-heading color">
Expand Down Expand Up @@ -117,8 +127,4 @@
}
}
}

function community() { //these are here to add quick buttons to add a phrase into the search engine
;
}
</script>

0 comments on commit a234857

Please sign in to comment.