From d7c644f0e7062bd847911bcfd9d9eaf401f3c36d Mon Sep 17 00:00:00 2001 From: Alex Shpak Date: Wed, 19 May 2021 20:26:21 +0200 Subject: Refactor search, prepare for pre-built indexing --- assets/search-data.js | 32 -------------------------------- 1 file changed, 32 deletions(-) delete mode 100644 assets/search-data.js (limited to 'assets/search-data.js') diff --git a/assets/search-data.js b/assets/search-data.js deleted file mode 100644 index a93664e..0000000 --- a/assets/search-data.js +++ /dev/null @@ -1,32 +0,0 @@ -'use strict'; - -(function () { - const indexCfg = {{ with i18n "bookSearchConfig" }} - {{ . }}; - {{ else }} - {}; - {{ end }} - - indexCfg.doc = { - id: 'id', - field: ['title', 'content'], - store: ['title', 'href', 'section'], - }; - - const index = FlexSearch.create('balance', indexCfg); - window.bookSearchIndex = index; - - {{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}} - {{- $pages = where $pages "Params.booksearchexclude" "!=" true -}} - {{- $pages = where $pages "Content" "not in" (slice nil "") -}} - - {{ range $index, $page := $pages }} - index.add({ - 'id': {{ $index }}, - 'href': '{{ $page.RelPermalink }}', - 'title': {{ (partial "docs/title" $page) | jsonify }}, - 'section': {{ (partial "docs/title" $page.Parent) | jsonify }}, - 'content': {{ $page.Plain | jsonify }} - }); - {{- end -}} -})(); -- cgit v1.2.3