locale lowercase

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2026-02-20 10:56:31 +01:00
parent f3b3b1dafb
commit 02443480b3
@@ -187,7 +187,7 @@ function applyPredicateInStrategy(
return targetQuery[negate ? 'andWhereNot' : 'andWhere'](
function fieldFilter() {
for (const [key, value] of Object.entries(filter)) {
const normalizedKey = key.toLowerCase();
const normalizedKey = key.toLocaleLowerCase('en-US');
if (isExistsValue(value)) {
// Handle $exists
@@ -202,7 +202,9 @@ function applyPredicateInStrategy(
}
} else if (isInValue(value)) {
// Handle $in
const values = value.$in.map(v => String(v).toLowerCase());
const values = value.$in.map(v =>
String(v).toLocaleLowerCase('en-US'),
);
const matchQuery = knex<DbSearchRow>('search')
.select('search.entity_id')
.where({ key: normalizedKey })
@@ -210,7 +212,7 @@ function applyPredicateInStrategy(
this.andWhere(onEntityIdField, 'in', matchQuery);
} else if (isHasPrefixValue(value)) {
// Handle $hasPrefix
const prefix = value.$hasPrefix.toLowerCase();
const prefix = value.$hasPrefix.toLocaleLowerCase('en-US');
const escaped = prefix.replace(/[%_\\]/g, c => `\\${c}`);
const matchQuery = knex<DbSearchRow>('search')
.select('search.entity_id')
@@ -227,7 +229,7 @@ function applyPredicateInStrategy(
.select('search.entity_id')
.where({
key: normalizedKey,
value: String(value).toLowerCase(),
value: String(value).toLocaleLowerCase('en-US'),
});
this.andWhere(onEntityIdField, 'in', matchQuery);
} else {