1
0
mirror of https://github.com/nextapps-de/flexsearch.git synced 2025-09-25 04:51:29 +02:00

disable post-filter after stemmer

This commit is contained in:
Thomas Wilkerling
2025-04-12 10:29:53 +02:00
parent 0abd307853
commit c767fef769
24 changed files with 2627 additions and 83 deletions

View File

@@ -439,15 +439,22 @@ Encoder.prototype.encode = function (str) {
// }
this.stemmer_test || (this.stemmer_test = new RegExp("(?!^)(" + this.stemmer_str + ")$"));
const old = word;
//const old = word;
word = word.replace(this.stemmer_test, match => this.stemmer.get(match));
// if(old !== word && word.length > 2){
// word = word.replace(this.stemmer_test, match => this.stemmer.get(match));
// }
// 4. post-filter after stemmer was applied
if (old !== word && this.filter && word.length >= this.minlength) {
if ("function" == typeof this.filter ? !this.filter(word) : this.filter.has(word)) {
word = "";
}
}
// if(old !== word && this.filter && word.length >= this.minlength){
// if(typeof this.filter === "function"
// ? !this.filter(word)
// : this.filter.has(word)
// ){
// word = "";
// }
// }
}
// apply mapper and collapsing

View File

@@ -55,7 +55,7 @@ export default function Index(options, _register) {
this.fastupdate = !!options.fastupdate;
this.score = options.score || null;
if (context && "strict" !== this.tokenize) {
if (context && context.depth && "strict" !== this.tokenize) {
console.warn("Context-Search could not applied, because it is just supported when using the tokenizer \"strict\".");
}