Fixing issue #4239 (FTS not working for multiple word query)
This commit is contained in:
Nate Sesti 2025-04-29 09:40:45 -07:00 • committed by GitHub
commit 5d5cf0226d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -68,7 +68,7 @@ export default class BaseRetrievalPipeline implements IRetrievalPipeline {
const cleanedTokens = [...tokens].join(" ");
const trigrams = nlp.string.ngram(cleanedTokens, 3);
return trigrams;
return trigrams.map(this.escapeFtsQueryString);
}
private escapeFtsQueryString(query: string): string {
@ -84,9 +84,8 @@ export default class BaseRetrievalPipeline implements IRetrievalPipeline {
return [];
}
const tokensRaw = this.getCleanedTrigrams(args.query).join(" OR ");
const tokens = this.escapeFtsQueryString(tokensRaw);
const tokens = this.getCleanedTrigrams(args.query).join(" OR ");
return await this.ftsIndex.retrieve({
n,
text: tokens,