Improved documentation and fixed search reset

This commit is contained in:
squidfunk
2020-02-17 14:37:12 +01:00
parent fdffefd536
commit 7876148fbd
32 changed files with 106 additions and 68 deletions

View File

@@ -33,6 +33,13 @@ import { PackerMessage } from "../message"
/**
* Setup packer web worker
*
* This function will create a web worker that helps in packing and unpacking
* strings using an LZ-based algorithm, namely `lz-string`. Its main purpose is
* to compress the search index before storing it in local storage, so it can
* be retrieved and imported to minimize the time necessary to setup search.
*
* @see https://bit.ly/2Q1ArhU - LZ-String documentation
*
* @param url - Worker url
*
* @return Worker handler

View File

@@ -113,7 +113,7 @@ export function setupSearchWorker(
pluck("response")
)
/* Send index to search worker */
/* Send index to worker */
index$
.pipe<SearchSetupMessage>(
map(data => ({

View File

@@ -40,6 +40,9 @@ let index: SearchIndex
/**
* Setup multi-language support through `lunr-languages`
*
* This function will automatically import the stemmers necessary to process
* the languages which were given through the search index configuration.
*
* @param config - Search index configuration
*/
function setupLunrLanguages(config: SearchIndexConfig): void {
@@ -58,7 +61,7 @@ function setupLunrLanguages(config: SearchIndexConfig): void {
/* Load scripts synchronously */
if (scripts.length)
importScripts(
self.importScripts(
`${base}/min/lunr.stemmer.support.min.js`,
...scripts
)