AI rule node: improve text search query

This commit is contained in:
Dmytro Skarzhynets 2025-07-09 20:55:54 +03:00
parent e7c971a7bb
commit ed47569f07
No known key found for this signature in database
GPG Key ID: 2B51652F224037DF

View File

@ -42,8 +42,8 @@ interface AiModelRepository extends JpaRepository<AiModelEntity, UUID>, Exportab
WHERE model.tenant_id = :tenantId WHERE model.tenant_id = :tenantId
AND (:textSearch IS NULL AND (:textSearch IS NULL
OR model.name ILIKE '%' || :textSearch || '%' OR model.name ILIKE '%' || :textSearch || '%'
OR (model.configuration ->> 'provider') ILIKE '%' || :textSearch || '%' OR REPLACE(model.configuration ->> 'provider', '_', ' ') ILIKE '%' || :textSearch || '%'
OR (model.configuration ->> 'modelId') ILIKE '%' || :textSearch || '%') OR model.configuration ->> 'modelId' ILIKE '%' || :textSearch || '%')
""", """,
countQuery = """ countQuery = """
SELECT COUNT(*) SELECT COUNT(*)
@ -51,7 +51,7 @@ interface AiModelRepository extends JpaRepository<AiModelEntity, UUID>, Exportab
WHERE model.tenant_id = :tenantId WHERE model.tenant_id = :tenantId
AND (:textSearch IS NULL AND (:textSearch IS NULL
OR model.name ILIKE '%' || :textSearch || '%' OR model.name ILIKE '%' || :textSearch || '%'
OR (model.configuration ->> 'provider') ILIKE '%' || :textSearch || '%' OR REPLACE(model.configuration ->> 'provider', '_', ' ') ILIKE '%' || :textSearch || '%'
OR (model.configuration ->> 'modelId') ILIKE '%' || :textSearch || '%') OR (model.configuration ->> 'modelId') ILIKE '%' || :textSearch || '%')
""", """,
nativeQuery = true nativeQuery = true