From a90918079833f6f89433f1dd9acbba5d7fb5ecba Mon Sep 17 00:00:00 2001 From: KoloMl Date: Sun, 14 Jun 2026 01:29:17 +0400 Subject: [PATCH] Fixed terms not trimming out the whitespaces --- src/lib/philomena/search/QueryLexer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/philomena/search/QueryLexer.ts b/src/lib/philomena/search/QueryLexer.ts index 5099cf6..1eba2f5 100644 --- a/src/lib/philomena/search/QueryLexer.ts +++ b/src/lib/philomena/search/QueryLexer.ts @@ -151,7 +151,7 @@ export class QueryLexer { dirtyText = this.#parseDirtyText(this.#index); if (dirtyText) { - tokens.push(new TermToken(this.#index, dirtyText)); + tokens.push(new TermToken(this.#index, dirtyText.trim())); this.#index += dirtyText.length; continue; } @@ -244,7 +244,7 @@ export class QueryLexer { static #bracketsCloseCharacter = ")"; static #boostOperator = /\^[+-]?\d+(?:\.\d+)?/y; static #whitespaces = /\s+/y; - static #quotedText = /"((?:\\.|[^\\"])+)"/y; + static #quotedText = /"\s*((?:\\.|[^\\"])+?)\s*"/y; static #dirtyTextStopWords = /,|\s+(?:AND|&&|OR|\|\|)\s+|\s*(?:\)|\^[+-]?\d+(?:\.\d+)?)/y; static #dirtyTextContent = /\\.|[^()]/y; }