aboutsummaryrefslogtreecommitdiff
path: root/assets/search-data.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/search-data.js')
-rw-r--r--assets/search-data.js28
1 files changed, 17 insertions, 11 deletions
diff --git a/assets/search-data.js b/assets/search-data.js
index dee01f6..6848438 100644
--- a/assets/search-data.js
+++ b/assets/search-data.js
@@ -3,22 +3,28 @@
{{ range $index, $page := .Site.Pages }}
{{- if $index -}},{{- end }}
{
- "idx": {{ $index }},
- "href": "{{ $page.RelPermalink }}",
- "title": {{ (partial "docs/title" $page) | jsonify }},
- "content": {{ $page.Plain | jsonify }}
+ 'idx': {{ $index }},
+ 'href': '{{ $page.RelPermalink }}',
+ 'title': {{ (partial "docs/title" $page) | jsonify }},
+ 'content': {{ $page.Plain | jsonify }}
}
{{- end -}}
];
+ var index = new FlexSearch({
+ cache: true,
+ encode: 'balance',
+ /* tokenize: function(str) {
+ return str.replace(/[\x00-\x7F]/g, ' ').split('');
+ } */
+ });
+
+ pages.forEach(function(page, x) {
+ index.add(x, pages[x].content);
+ })
+
window.bookSearch = {
pages: pages,
- idx: lunr(function() {
- this.ref("idx");
- this.field("title");
- this.field("content");
-
- pages.forEach(this.add, this);
- }),
+ index: index,
}
})();