Fixed search indexing of multi-word tags

This commit is contained in:
squidfunk
2022-06-08 20:06:51 +02:00
parent ff9e41f329
commit cfe83ccbba
4 changed files with 9 additions and 6 deletions

View File

@@ -204,7 +204,10 @@ export class Search {
/* Set up fields */
this.field("title", { boost: 1e3 })
this.field("text")
this.field("tags", { boost: 1e6 })
this.field("tags", { boost: 1e6, extractor: doc => {
const { tags = [] } = doc as SearchDocument
return tags.flatMap(tag => lunr.tokenizer(tag))
} })
/* Index documents */
for (const doc of docs)