Browse Source

AI rule node: improve text search query

pull/13371/head
Dmytro Skarzhynets 1 year ago
parent
commit
ed47569f07
No known key found for this signature in database GPG Key ID: 2B51652F224037DF
  1. 6
      dao/src/main/java/org/thingsboard/server/dao/sql/ai/AiModelRepository.java

6
dao/src/main/java/org/thingsboard/server/dao/sql/ai/AiModelRepository.java

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

Loading…
Cancel
Save