From a06662f4ce6d8065233481dbd89e01e7bf9a12b3 Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 21 May 2020 13:45:18 +0200 Subject: [PATCH] fuzzy search for values as well --- src/services/search/parser.js | 6 +++++- src/services/search/parsing_context.js | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/services/search/parser.js b/src/services/search/parser.js index da81e9218..d13e1c93d 100644 --- a/src/services/search/parser.js +++ b/src/services/search/parser.js @@ -54,11 +54,15 @@ function getExpression(tokens, parsingContext) { parsingContext.highlightedTokens.push(token.substr(1)); if (i < tokens.length - 2 && isOperator(tokens[i + 1])) { - const operator = tokens[i + 1]; + let operator = tokens[i + 1]; const comparedValue = tokens[i + 2]; parsingContext.highlightedTokens.push(comparedValue); + if (parsingContext.fuzzyAttributeSearch && operator === '=') { + operator = '*=*'; + } + const comparator = comparatorBuilder(operator, comparedValue); if (!comparator) { diff --git a/src/services/search/parsing_context.js b/src/services/search/parsing_context.js index f76ff3b3d..24118050f 100644 --- a/src/services/search/parsing_context.js +++ b/src/services/search/parsing_context.js @@ -4,6 +4,7 @@ class ParsingContext { constructor(includeNoteContent) { this.includeNoteContent = includeNoteContent; this.highlightedTokens = []; + this.fuzzyAttributeSearch = false; this.error = null; }