mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-31 00:16:47 +01:00
chore: optimize sql query to not concatenate (#5321)
This commit is contained in:
parent
7f4df19660
commit
00327c359d
@ -562,12 +562,20 @@ class FeatureStrategiesStore implements IFeatureStrategiesStore {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
if (hasHalfTag) {
|
if (hasHalfTag) {
|
||||||
const tagParameter = normalizedHalfTag.map((tag) => `%${tag}%`);
|
const tagParameters = normalizedHalfTag.map(
|
||||||
tagQuery.orWhereRaw(
|
(tag) => `%${tag}%`,
|
||||||
`(?? || ':' || ??) ILIKE ANY (ARRAY[${tagParameter
|
);
|
||||||
|
const tagQueryParameters = normalizedHalfTag
|
||||||
.map(() => '?')
|
.map(() => '?')
|
||||||
.join(',')}])`,
|
.join(',');
|
||||||
['tag_type', 'tag_value', ...tagParameter],
|
tagQuery
|
||||||
|
.orWhereRaw(
|
||||||
|
`(??) ILIKE ANY (ARRAY[${tagQueryParameters}])`,
|
||||||
|
['tag_type', ...tagParameters],
|
||||||
|
)
|
||||||
|
.orWhereRaw(
|
||||||
|
`(??) ILIKE ANY (ARRAY[${tagQueryParameters}])`,
|
||||||
|
['tag_value', ...tagParameters],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user