Fixed search in German, French and other languages

This commit is contained in:
squidfunk
2020-06-07 13:56:45 +02:00
parent 1df750a9fe
commit 36e1e3db8b
26 changed files with 46 additions and 27 deletions

View File

@@ -138,11 +138,6 @@ export class Search {
this.index = lunr(function() {
pipeline = pipeline || ["trimmer", "stopWordFilter"]
/* Set up pipeline according to configuration */
this.pipeline.reset()
for (const fn of pipeline)
this.pipeline.add(lunr[fn])
/* Set up alternate search languages */
if (config.lang.length === 1 && config.lang[0] !== "en") {
this.use((lunr as any)[config.lang[0]])
@@ -150,6 +145,16 @@ export class Search {
this.use((lunr as any).multiLanguage(...config.lang))
}
/* Set up pipeline according to configuration */
this.pipeline.reset()
for (const fn of pipeline)
this.pipeline.add(lunr[fn])
/* Set up search pipeline according to configuration */
this.searchPipeline.reset()
for (const fn of pipeline)
this.searchPipeline.add(lunr[fn])
/* Set up fields and reference */
this.field("title", { boost: 1000 })
this.field("text")