chore(deps): update flexsearch to version 0.8.205 and adjust search encoder.

This commit is contained in:
Amir Pourmand 2025-08-28 10:22:02 +03:30
parent 0a57d032a7
commit 2cf2f16e70
3 changed files with 35 additions and 7 deletions

35
package-lock.json generated
View File

@ -20,7 +20,7 @@
"cli-spinner": "^0.2.10", "cli-spinner": "^0.2.10",
"d3": "^7.9.0", "d3": "^7.9.0",
"esbuild-sass-plugin": "^3.3.1", "esbuild-sass-plugin": "^3.3.1",
"flexsearch": "0.7.43", "flexsearch": "^0.8.205",
"github-slugger": "^2.0.0", "github-slugger": "^2.0.0",
"globby": "^14.1.0", "globby": "^14.1.0",
"gray-matter": "^4.0.3", "gray-matter": "^4.0.3",
@ -3189,9 +3189,36 @@
} }
}, },
"node_modules/flexsearch": { "node_modules/flexsearch": {
"version": "0.7.43", "version": "0.8.205",
"resolved": "https://registry.npmjs.org/flexsearch/-/flexsearch-0.7.43.tgz", "resolved": "https://registry.npmjs.org/flexsearch/-/flexsearch-0.8.205.tgz",
"integrity": "sha512-c5o/+Um8aqCSOXGcZoqZOm+NqtVwNsvVpWv6lfmSclU954O3wvQKxxK8zj74fPaSJbXpSLTs4PRhh+wnoCXnKg==" "integrity": "sha512-REFjMqy86DKkCTJ4gIE42c9MVm9t1vUWfEub/8taixYuhvyu4jd4XmFALk5VuKW4GH4VLav8A4BJboTsslHF1w==",
"funding": [
{
"type": "github",
"url": "https://github.com/ts-thomas"
},
{
"type": "opencollective",
"url": "https://opencollective.com/flexsearch"
},
{
"type": "patreon",
"url": "https://patreon.com/user?u=96245532"
},
{
"type": "liberapay",
"url": "https://liberapay.com/ts-thomas"
},
{
"type": "paypal",
"url": "https://www.paypal.com/donate/?hosted_button_id=GEVR88FC9BWRW"
},
{
"type": "bountysource",
"url": "https://salt.bountysource.com/teams/ts-thomas"
}
],
"license": "Apache-2.0"
}, },
"node_modules/format": { "node_modules/format": {
"version": "0.2.2", "version": "0.2.2",

View File

@ -46,7 +46,7 @@
"cli-spinner": "^0.2.10", "cli-spinner": "^0.2.10",
"d3": "^7.9.0", "d3": "^7.9.0",
"esbuild-sass-plugin": "^3.3.1", "esbuild-sass-plugin": "^3.3.1",
"flexsearch": "0.7.43", "flexsearch": "^0.8.205",
"github-slugger": "^2.0.0", "github-slugger": "^2.0.0",
"globby": "^14.1.0", "globby": "^14.1.0",
"gray-matter": "^4.0.3", "gray-matter": "^4.0.3",

View File

@ -15,13 +15,14 @@ interface Item {
type SearchType = "basic" | "tags" type SearchType = "basic" | "tags"
let searchType: SearchType = "basic" let searchType: SearchType = "basic"
let currentSearchTerm: string = "" let currentSearchTerm: string = ""
const encoder = (str: string) => str.toLowerCase().split(/([^a-z]|[^\x00-\x7F])/) const encoder = (str: string) => str.toLowerCase().split(/\s+/)
let index = new FlexSearch.Document<Item>({ let index = new FlexSearch.Document<Item>({
charset: "latin:extra", charset: "Default",
encode: encoder, encode: encoder,
document: { document: {
id: "id", id: "id",
tag: "tags", tag: "tags",
rtl: true,
index: [ index: [
{ {
field: "title", field: "title",