fulltext search use each word separately

This commit is contained in:
2023-03-15 15:15:47 +01:00
parent 6b49b688ac
commit 7bebc05e08

View File

@@ -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':