Host FlexSearch

This commit is contained in:
Will Faught
2025-03-02 00:23:46 -08:00
parent 2e77b35940
commit 078157e62c
164 changed files with 23495 additions and 1 deletions

View File

@@ -0,0 +1,29 @@
import { IndexInterface } from "../../type.js";
import { pipeline } from "../../lang.js";
export const rtl = true;
export const tokenize = "";
export default {
encode: encode,
rtl: rtl
}
const regex = /[\x00-\x7F]+/g;
const split = /\s+/;
/**
* @param {string|number} str
* @this IndexInterface
*/
export function encode(str){
return pipeline.call(
this,
/* string: */ ("" + str).replace(regex, " "),
/* normalize: */ false,
/* split: */ split,
/* collapse: */ false
);
}

172
paige/node_modules/flexsearch/src/lang/at.js generated vendored Normal file
View File

@@ -0,0 +1,172 @@
/**
* http://www.ranks.nl/stopwords
* @type {Array<string>}
*/
export const filter = [
"aber",
"als",
"am",
"an",
"auch",
"auf",
"aus",
"bei",
"bin",
"bis",
"bist",
"da",
"dadurch",
"daher",
"darum",
"das",
"daß",
"dass",
"dein",
"deine",
"dem",
"den",
"der",
"des",
"dessen",
"deshalb",
"die",
"dies",
"dieser",
"dieses",
"doch",
"dort",
"du",
"durch",
"ein",
"eine",
"einem",
"einen",
"einer",
"eines",
"er",
"es",
"euer",
"eure",
"für",
"hatte",
"hatten",
"hattest",
"hattet",
"hier",
"hinter",
"ich",
"ihr",
"ihre",
"im",
"in",
"ist",
"ja",
"jede",
"jedem",
"jeden",
"jeder",
"jedes",
"jener",
"jenes",
"jetzt",
"kann",
"kannst",
"können",
"könnt",
"machen",
"mein",
"meine",
"mit",
"muß",
"mußt",
"musst",
"müssen",
"müßt",
"nach",
"nachdem",
"nein",
"nicht",
"nun",
"oder",
"seid",
"sein",
"seine",
"sich",
"sie",
"sind",
"soll",
"sollen",
"sollst",
"sollt",
"sonst",
"soweit",
"sowie",
"und",
"unser",
"unsere",
"unter",
"vom",
"von",
"vor",
"wann",
"warum",
"was",
"weiter",
"weitere",
"wenn",
"wer",
"werde",
"werden",
"werdet",
"weshalb",
"wie",
"wieder",
"wieso",
"wir",
"wird",
"wirst",
"wo",
"woher",
"wohin",
"zu",
"zum",
"zur",
"über"
];
/**
* @type {Object<string, string>}
*/
export const stemmer = {
"niss": "",
"isch": "",
"lich": "",
"heit": "",
"keit": "",
"end": "",
"ung": "",
"est": "",
"ern": "",
"em": "",
"er": "",
"en": "",
"es": "",
"st": "",
"ig": "",
"ik": "",
"e": "",
"s": ""
};
export const matcher = {};
export default {
filter: filter,
stemmer: stemmer,
matcher: matcher
}

29
paige/node_modules/flexsearch/src/lang/cjk/default.js generated vendored Normal file
View File

@@ -0,0 +1,29 @@
import { IndexInterface } from "../../type.js";
import { pipeline } from "../../lang.js";
export const rtl = false;
export const tokenize = "strict";
export default {
encode: encode,
rtl: rtl,
tokenize: tokenize
}
const regex = /[\x00-\x7F]+/g;
/**
* @param {string|number} str
* @this IndexInterface
*/
export function encode(str){
return pipeline.call(
this,
/* string: */ ("" + str).replace(regex, ""),
/* normalize: */ false,
/* split: */ "",
/* collapse: */ false
);
}

View File

@@ -0,0 +1,29 @@
import { IndexInterface } from "../../type.js";
import { pipeline } from "../../lang.js";
export const rtl = false;
export const tokenize = "";
export default {
encode: encode,
rtl: rtl
}
const regex = /[\x00-\x7F]+/g;
const split = /\s+/;
/**
* @param {string|number} str
* @this IndexInterface
*/
export function encode(str){
return pipeline.call(
this,
/* string: */ ("" + str).replace(regex, " "),
/* normalize: */ false,
/* split: */ split,
/* collapse: */ false
);
}

185
paige/node_modules/flexsearch/src/lang/de.js generated vendored Normal file
View File

@@ -0,0 +1,185 @@
/**
* Filter are also known as "stopwords", they completely filter out words from being indexed.
* Source: http://www.ranks.nl/stopwords
* Object Definition: Just provide an array of words.
* @type {Array<string>}
*/
export const filter = [
"aber",
"als",
"am",
"an",
"auch",
"auf",
"aus",
"bei",
"bin",
"bis",
"bist",
"da",
"dadurch",
"daher",
"darum",
"das",
"daß",
"dass",
"dein",
"deine",
"dem",
"den",
"der",
"des",
"dessen",
"deshalb",
"die",
"dies",
"dieser",
"dieses",
"doch",
"dort",
"du",
"durch",
"ein",
"eine",
"einem",
"einen",
"einer",
"eines",
"er",
"es",
"euer",
"eure",
"für",
"hatte",
"hatten",
"hattest",
"hattet",
"hier",
"hinter",
"ich",
"ihr",
"ihre",
"im",
"in",
"ist",
"ja",
"jede",
"jedem",
"jeden",
"jeder",
"jedes",
"jener",
"jenes",
"jetzt",
"kann",
"kannst",
"können",
"könnt",
"machen",
"mein",
"meine",
"mit",
"muß",
"mußt",
"musst",
"müssen",
"müßt",
"nach",
"nachdem",
"nein",
"nicht",
"nun",
"oder",
"seid",
"sein",
"seine",
"sich",
"sie",
"sind",
"soll",
"sollen",
"sollst",
"sollt",
"sonst",
"soweit",
"sowie",
"und",
"unser",
"unsere",
"unter",
"vom",
"von",
"vor",
"wann",
"warum",
"was",
"weiter",
"weitere",
"wenn",
"wer",
"werde",
"werden",
"werdet",
"weshalb",
"wie",
"wieder",
"wieso",
"wir",
"wird",
"wirst",
"wo",
"woher",
"wohin",
"zu",
"zum",
"zur",
"über"
];
/**
* Stemmer removes word endings and is a kind of "partial normalization". A word ending just matched when the word length is bigger than the matched partial.
* Example: The word "correct" and "correctness" could be the same word, so you can define {"ness": ""} to normalize the ending.
* Object Definition: the key represents the word ending, the value contains the replacement (or empty string for removal).
* @type {Object<string, string>}
*/
export const stemmer = {
"niss": "",
"isch": "",
"lich": "",
"heit": "",
"keit": "",
"ell": "",
"bar": "",
"end": "",
"ung": "",
"est": "",
"ern": "",
"em": "",
"er": "",
"en": "",
"es": "",
"st": "",
"ig": "",
"ik": "",
"e": "",
"s": ""
};
/**
* Matcher replaces all occurrences of a given string regardless of its position and is also a kind of "partial normalization".
* Object Definition: the key represents the target term, the value contains the search string which should be replaced (could also be an array of multiple terms).
* @type {Object<string, Array<string>|string>}
*/
export const matcher = {};
export default {
filter: filter,
stemmer: stemmer,
matcher: matcher
}

276
paige/node_modules/flexsearch/src/lang/en.js generated vendored Normal file
View File

@@ -0,0 +1,276 @@
/**
* http://www.ranks.nl/stopwords
* @type {Array<string>}
*/
export const filter = [
"a",
"about",
"above",
"after",
"again",
"against",
"all",
"also",
"am",
"an",
"and",
"any",
"are",
"aren't",
"as",
"at",
//"back",
"be",
"because",
"been",
"before",
"being",
"below",
//"between",
"both",
"but",
"by",
"can",
"cannot",
"can't",
"come",
"could",
"couldn't",
//"day",
"did",
"didn't",
"do",
"does",
"doesn't",
"doing",
"dont",
"down",
"during",
"each",
"even",
"few",
"first",
"for",
"from",
"further",
"get",
//"give",
"go",
//"good",
"had",
"hadn't",
"has",
"hasn't",
"have",
"haven't",
"having",
"he",
"hed",
//"hell",
"her",
"here",
"here's",
"hers",
"herself",
"hes",
"him",
"himself",
"his",
"how",
"how's",
"i",
"id",
"if",
"ill",
"im",
"in",
"into",
"is",
"isn't",
"it",
"it's",
"itself",
"i've",
"just",
"know",
"let's",
"like",
//"look",
"make",
"me",
"more",
"most",
"mustn't",
"my",
"myself",
"new",
"no",
"nor",
"not",
"now",
"of",
"off",
"on",
"once",
//"one",
"only",
"or",
"other",
"ought",
"our",
"our's",
"ourselves",
"out",
"over",
"own",
//"people",
"same",
"say",
"see",
"shan't",
"she",
"she'd",
"shell",
"shes",
"should",
"shouldn't",
"so",
"some",
"such",
//"take",
"than",
"that",
"that's",
"the",
"their",
"theirs",
"them",
"themselves",
"then",
"there",
"there's",
"these",
"they",
"they'd",
"they'll",
"they're",
"they've",
//"think",
"this",
"those",
"through",
"time",
"to",
"too",
//"two",
//"under",
"until",
"up",
"us",
//"use",
"very",
"want",
"was",
"wasn't",
"way",
"we",
"wed",
"well",
"were",
"weren't",
"we've",
"what",
"what's",
"when",
"when's",
"where",
"where's",
"which",
"while",
"who",
"whom",
"who's",
"why",
"why's",
"will",
"with",
"won't",
//"work",
"would",
"wouldn't",
//"year",
"you",
"you'd",
"you'll",
"your",
"you're",
"your's",
"yourself",
"yourselves",
"you've"
];
/**
* @type {Object<string, string>}
*/
export const stemmer = {
"ational": "ate",
"iveness": "ive",
"fulness": "ful",
"ousness": "ous",
"ization": "ize",
"tional": "tion",
"biliti": "ble",
"icate": "ic",
"ative": "",
"alize": "al",
"iciti": "ic",
"entli": "ent",
"ousli": "ous",
"alism": "al",
"ation": "ate",
"aliti": "al",
"iviti": "ive",
"ement": "",
"enci": "ence",
"anci": "ance",
"izer": "ize",
"alli": "al",
"ator": "ate",
"logi": "log",
"ical": "ic",
"ance": "",
"ence": "",
"ness": "",
"able": "",
"ible": "",
"ment": "",
"eli": "e",
"bli": "ble",
"ful": "",
"ant": "",
"ent": "",
"ism": "",
"ate": "",
"iti": "",
"ous": "",
"ive": "",
"ize": "",
"al": "",
"ou": "",
"er": "",
"ic": ""
};
export const matcher = {};
export default {
filter: filter,
stemmer: stemmer,
matcher: matcher
}

View File

@@ -0,0 +1,92 @@
import { IndexInterface } from "../../type.js";
import { regex, replace, collapse } from "../../lang.js";
import { encode as encode_balance } from "./balance.js";
export const rtl = false;
export const tokenize = "";
export default {
encode: encode,
rtl: rtl,
tokenize: tokenize
}
// Phonetic Normalization
const regex_ae = regex("ae"),
//regex_ai = regex("ai"),
//regex_ay = regex("ay"),
//regex_ey = regex("ey"),
regex_oe = regex("oe"),
//regex_ue = regex("ue"),
//regex_ie = regex("ie"),
//regex_sz = regex("sz"),
//regex_zs = regex("zs"),
//regex_ck = regex("ck"),
//regex_cc = regex("cc"),
regex_sh = regex("sh"),
regex_th = regex("th"),
//regex_dt = regex("dt"),
regex_ph = regex("ph"),
regex_pf = regex("pf");
//regex_ou = regex("ou"),
//regex_uo = regex("uo");
const pairs = [
regex_ae, "a",
// regex_ai, "ei",
// regex_ay, "ei",
// regex_ey, "ei",
regex_oe, "o",
// regex_ue, "u",
// regex_ie, "i",
// regex_sz, "s",
// regex_zs, "s",
regex_sh, "s",
// regex_ck, "k",
// regex_cc, "k",
regex_th, "t",
// regex_dt, "t",
regex_ph, "f",
regex_pf, "f",
// regex_ou, "o",
// regex_uo, "u"
// regex("(?![aeiouy])h(?![aeiouy])"), "",
// regex("(?!^[aeiouy])h(?!^[aeiouy])"), ""
regex("(?![aeo])h(?![aeo])"), "",
regex("(?!^[aeo])h(?!^[aeo])"), ""
];
/**
* @param {string|number} str
* @param {boolean=} _skip_postprocessing
* @this IndexInterface
*/
export function encode(str, _skip_postprocessing){
if(str){
str = encode_balance.call(this, str).join(" ");
if(str.length > 2){
str = replace(str, pairs);
}
if(!_skip_postprocessing){
if(str.length > 1){
str = collapse(str);
}
if(str){
str = str.split(" ");
}
}
}
return str || [];
}

119
paige/node_modules/flexsearch/src/lang/latin/balance.js generated vendored Normal file
View File

@@ -0,0 +1,119 @@
import { IndexInterface } from "../../type.js";
import { encode as encode_simple } from "./simple.js";
// custom soundex implementation
export const rtl = false;
export const tokenize = "strict";
export default {
encode: encode,
rtl: rtl,
tokenize: tokenize
}
//const regex_whitespace = /[\W_]+/g;
const regex_strip = /[^a-z0-9]+/;
// const pairs = [
// regex_whitespace, " ",
// regex_strip, ""
// ];
// modified
const soundex = {
"b": "p",
//"p": "p",
//"f": "f",
"v": "f",
"w": "f",
//"s": "s",
"z": "s",
"x": "s",
"ß": "s",
"d": "t",
//"t": "t",
//"l": "l",
//"m": "m",
"n": "m",
"c": "k",
"g": "k",
"j": "k",
//"k": "k",
"q": "k",
//"r": "r",
//"h": "h",
//"a": "a",
//"e": "e",
"i": "e",
"y": "e",
//"o": "o",
"u": "o"
};
/**
* @param {string|number} str
* @this IndexInterface
*/
export function encode(str){
str = encode_simple.call(this, str).join(" ");
// str = this.pipeline(
//
// /* string: */ normalize("" + str).toLowerCase(),
// /* normalize: */ false,
// /* split: */ false,
// /* collapse: */ false
// );
const result = [];
if(str){
const words = str.split(regex_strip);
const length = words.length;
for(let x = 0, tmp, count = 0; x < length; x++){
if((str = words[x]) /*&& (str.length > 2)*/ && (!this.filter || !this.filter[str])){
tmp = str[0];
let code = soundex[tmp] || tmp; //str[0];
let previous = code; //soundex[code] || code;
for(let i = 1; i < str.length; i++){
tmp = str[i];
const current = soundex[tmp] || tmp;
if(current && (current !== previous)){
code += current;
previous = current;
// if(code.length === 7){
//
// break;
// }
}
}
result[count++] = code; //(code + "0000").substring(0, 4);
}
}
}
return result;
}

View File

@@ -0,0 +1,27 @@
import { IndexInterface } from "../../type.js";
import { pipeline, normalize, regex_whitespace } from "../../lang.js";
export const rtl = false;
export const tokenize = "";
export default {
encode: encode,
rtl: rtl,
tokenize: tokenize
}
/**
* @param {string|number} str
* @this IndexInterface
*/
export function encode(str){
return pipeline.call(
this,
/* string: */ ("" + str).toLowerCase(),
/* normalize: */ false,
/* split: */ regex_whitespace,
/* collapse: */ false
);
}

67
paige/node_modules/flexsearch/src/lang/latin/extra.js generated vendored Normal file
View File

@@ -0,0 +1,67 @@
import { IndexInterface } from "../../type.js";
import { regex, replace, collapse } from "../../lang.js";
import { encode as encode_advanced } from "./advanced.js";
export const rtl = false;
export const tokenize = "";
export default {
encode: encode,
rtl: rtl,
tokenize: tokenize
}
// Soundex Normalization
const prefix = "(?!\\b)";
const //soundex_b = regex(prefix + "p"),
// soundex_s = regex(prefix + "z"),
// soundex_k = regex(prefix + "[cgq]"),
// soundex_m = regex(prefix + "n"),
// soundex_t = regex(prefix + "d"),
// soundex_f = regex(prefix + "[vw]"),
//regex_vowel = regex(prefix + "[aeiouy]");
regex_vowel = regex(prefix + "[aeo]");
const pairs = [
// soundex_b, "b",
// soundex_s, "s",
// soundex_k, "k",
// soundex_m, "m",
// soundex_t, "t",
// soundex_f, "f",
// regex("(?![aeiouy])h(?![aeiouy])"), "",
// regex("(?!^[aeiouy])h(?!^[aeiouy])"), "",
regex_vowel, ""
];
/**
* @param {string|number} str
* @this IndexInterface
*/
export function encode(str){
if(str){
str = encode_advanced.call(this, str, /* skip post-processing: */ true);
if(str.length > 1){
//str = replace(str, pairs);
str = str.replace(regex_vowel, "");
}
if(str.length > 1){
str = collapse(str);
}
if(str){
str = str.split(" ");
}
}
return str || [];
}

60
paige/node_modules/flexsearch/src/lang/latin/simple.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
import { IndexInterface } from "../../type.js";
import { pipeline, normalize, regex_whitespace, regex } from "../../lang.js";
export const rtl = false;
export const tokenize = "";
export default {
encode: encode,
rtl: rtl,
tokenize: tokenize
}
// Charset Normalization
const //regex_whitespace = /\W+/,
//regex_strip = regex("[^a-z0-9 ]"),
regex_a = regex("[àáâãäå]"),
regex_e = regex("[èéêë]"),
regex_i = regex("[ìíîï]"),
regex_o = regex("[òóôõöő]"),
regex_u = regex("[ùúûüű]"),
regex_y = regex("[ýŷÿ]"),
regex_n = regex("ñ"),
regex_c = regex("[çc]"),
regex_s = regex("ß"),
regex_and = regex(" & ");
const pairs = [
regex_a, "a",
regex_e, "e",
regex_i, "i",
regex_o, "o",
regex_u, "u",
regex_y, "y",
regex_n, "n",
regex_c, "k",
regex_s, "s",
regex_and, " and "
//regex_whitespace, " "
//regex_strip, ""
];
/**
* @param {string|number} str
* @this IndexInterface
*/
export function encode(str){
str = "" + str;
return pipeline.call(
this,
/* string: */ normalize(str).toLowerCase(),
/* normalize: */ !str.normalize && pairs,
/* split: */ regex_whitespace,
/* collapse: */ false
);
}

276
paige/node_modules/flexsearch/src/lang/us.js generated vendored Normal file
View File

@@ -0,0 +1,276 @@
/**
* http://www.ranks.nl/stopwords
* @type {Array<string>}
*/
export const filter = [
"a",
"about",
"above",
"after",
"again",
"against",
"all",
"also",
"am",
"an",
"and",
"any",
"are",
"aren't",
"as",
"at",
//"back",
"be",
"because",
"been",
"before",
"being",
"below",
//"between",
"both",
"but",
"by",
"can",
"cannot",
"can't",
"come",
"could",
"couldn't",
//"day",
"did",
"didn't",
"do",
"does",
"doesn't",
"doing",
"dont",
"down",
"during",
"each",
"even",
"few",
"first",
"for",
"from",
"further",
"get",
//"give",
"go",
//"good",
"had",
"hadn't",
"has",
"hasn't",
"have",
"haven't",
"having",
"he",
"hed",
//"hell",
"her",
"here",
"here's",
"hers",
"herself",
"hes",
"him",
"himself",
"his",
"how",
"how's",
"i",
"id",
"if",
"ill",
"im",
"in",
"into",
"is",
"isn't",
"it",
"it's",
"itself",
"i've",
"just",
"know",
"let's",
"like",
//"look",
"make",
"me",
"more",
"most",
"mustn't",
"my",
"myself",
"new",
"no",
"nor",
"not",
"now",
"of",
"off",
"on",
"once",
//"one",
"only",
"or",
"other",
"ought",
"our",
"our's",
"ourselves",
"out",
"over",
"own",
//"people",
"same",
"say",
"see",
"shan't",
"she",
"she'd",
"shell",
"shes",
"should",
"shouldn't",
"so",
"some",
"such",
//"take",
"than",
"that",
"that's",
"the",
"their",
"theirs",
"them",
"themselves",
"then",
"there",
"there's",
"these",
"they",
"they'd",
"they'll",
"they're",
"they've",
//"think",
"this",
"those",
"through",
"time",
"to",
"too",
//"two",
//"under",
"until",
"up",
"us",
//"use",
"very",
"want",
"was",
"wasn't",
"way",
"we",
"wed",
"well",
"were",
"weren't",
"we've",
"what",
"what's",
"when",
"when's",
"where",
"where's",
"which",
"while",
"who",
"whom",
"who's",
"why",
"why's",
"will",
"with",
"won't",
//"work",
"would",
"wouldn't",
//"year",
"you",
"you'd",
"you'll",
"your",
"you're",
"your's",
"yourself",
"yourselves",
"you've"
];
/**
* @type {Object<string, string>}
*/
export const stemmer = {
"ational": "ate",
"iveness": "ive",
"fulness": "ful",
"ousness": "ous",
"ization": "ize",
"tional": "tion",
"biliti": "ble",
"icate": "ic",
"ative": "",
"alize": "al",
"iciti": "ic",
"entli": "ent",
"ousli": "ous",
"alism": "al",
"ation": "ate",
"aliti": "al",
"iviti": "ive",
"ement": "",
"enci": "ence",
"anci": "ance",
"izer": "ize",
"alli": "al",
"ator": "ate",
"logi": "log",
"ical": "ic",
"ance": "",
"ence": "",
"ness": "",
"able": "",
"ible": "",
"ment": "",
"eli": "e",
"bli": "ble",
"ful": "",
"ant": "",
"ent": "",
"ism": "",
"ate": "",
"iti": "",
"ous": "",
"ive": "",
"ize": "",
"al": "",
"ou": "",
"er": "",
"ic": ""
};
export const matcher = {};
export default {
filter: filter,
stemmer: stemmer,
matcher: matcher
}