From 7bebc05e083ff900329036b3c98fbbf4d2188ce8 Mon Sep 17 00:00:00 2001 From: ewandor Date: Wed, 15 Mar 2023 15:15:47 +0100 Subject: [PATCH] fulltext search use each word separately --- back/app/core/routes.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/back/app/core/routes.py b/back/app/core/routes.py index ade3a804..7e863584 100644 --- a/back/app/core/routes.py +++ b/back/app/core/routes.py @@ -39,7 +39,10 @@ def parse_query(query: str, model): or_array = [] for field in model.Settings.fulltext_search: - or_array.append(RegEx(field, value, 'i')) + words_and_array = [] + for word in value.split(' '): + words_and_array.append(RegEx(field, word, 'i')) + or_array.append(And(*words_and_array) if len(words_and_array) > 1 else words_and_array[0]) operand = Or(or_array) if len(or_array) > 1 else or_array[0] elif operator == 'eq':