Skip to content

Commit 80b2e5a

Browse files
committed
Fix case-insensitive flexsearch filters in InMemoryAdapter
1 parent 18bdf2f commit 80b2e5a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/database/inmemory/js-generator.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -964,11 +964,11 @@ register(OperatorWithAnalyzerQueryNode, (node, context) => {
964964
let rhs = processNode(node.rhs, context);
965965

966966
if (isCaseInsensitive) {
967-
lhs = js`${lhs}.toLowerCase()`;
967+
lhs = js`(${lhs})?.toLowerCase()`;
968968
const rhsVar = js.variable('rhs');
969969
rhs = jsExt.evaluatingLambda(
970970
rhsVar,
971-
js`(Array.isArray(${rhsVar}) ? ${rhsVar}.map(value => value.toLowerCase()) : ${rhsVar}.toLowerCase())`,
971+
js`(Array.isArray(${rhsVar}) ? ${rhsVar}.map(value => value?.toLowerCase()) : (${rhsVar})?.toLowerCase())`,
972972
rhs
973973
);
974974
}

0 commit comments

Comments
 (0)