do not use the very particular 'true' array syntax, but instead the normal one

Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
Fredrik Adelöw
2026-02-23 16:43:36 +01:00
parent b06bcdcb35
commit 63ad13904b
@@ -175,18 +175,18 @@ function applyFieldCondition(options: {
//
// FROM: `{ "a": { "$contains": "b" } }`
//
// TO: `{ "a.b": "true" }`
// TO: `{ "a": "b" }`
//
// The search table does not actually show us that "a" was an array to
// begin with, so this can mistakenly also match on an object that had a
// "b" key with a true value. We'll consider that an acceptable tradeoff
// though.
// "b" key with a primitive value. We'll consider that an acceptable
// tradeoff though.
if (isPrimitive(target)) {
const matchQuery = knex<DbSearchRow>('search')
.select('search.entity_id')
.where({
key: `${key}.${String(target).toLocaleLowerCase('en-US')}`,
value: 'true',
key,
value: String(target).toLocaleLowerCase('en-US'),
});
return targetQuery.andWhere(onEntityIdField, 'in', matchQuery);
}