Add base implementation of new tags search
This commit is contained in:
parent
fd735c3d82
commit
1bf3f6066e
@ -33,14 +33,29 @@ public interface WidgetTypeInfoRepository extends JpaRepository<WidgetTypeInfoEn
|
||||
"AND ((:widgetTypesEmpty) IS TRUE OR wti.widget_type IN (:widgetTypes)) " +
|
||||
"AND (wti.name ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR ((:fullSearch) IS TRUE AND (wti.description ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR lower(wti.tags\\:\\:text)\\:\\:text[] && string_to_array(lower(:searchText), ' '))))",
|
||||
// "OR to_tsvector(lower(array_to_string(wti.tags, ' '))) @@ to_tsquery(lower(:searchText)))))",
|
||||
"OR EXISTS (" +
|
||||
"SELECT 1 " +
|
||||
"FROM unnest(wti.tags) AS currentTag " +
|
||||
"WHERE :searchText ILIKE '%' || currentTag || '%' " +
|
||||
"AND (length(:searchText) = length(currentTag) " +
|
||||
"OR :searchText ILIKE currentTag || ' %' " +
|
||||
"OR :searchText ILIKE '% ' || currentTag " +
|
||||
"OR :searchText ILIKE '% ' || currentTag || ' %')" +
|
||||
"))))",
|
||||
countQuery = "SELECT count(*) FROM widget_type_info_view wti WHERE wti.tenant_id = :systemTenantId " +
|
||||
"AND ((:deprecatedFilterEnabled) IS FALSE OR wti.deprecated = :deprecatedFilter) " +
|
||||
"AND ((:widgetTypesEmpty) IS TRUE OR wti.widget_type IN (:widgetTypes)) " +
|
||||
"AND (wti.name ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR ((:fullSearch) IS TRUE AND (wti.description ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR lower(wti.tags\\:\\:text)\\:\\:text[] && string_to_array(lower(:searchText), ' '))))"
|
||||
"OR EXISTS (" +
|
||||
"SELECT 1 " +
|
||||
"FROM unnest(wti.tags) AS currentTag " +
|
||||
"WHERE :searchText ILIKE '%' || currentTag || '%' " +
|
||||
"AND (length(:searchText) = length(currentTag) " +
|
||||
"OR :searchText ILIKE currentTag || ' %' " +
|
||||
"OR :searchText ILIKE '% ' || currentTag " +
|
||||
"OR :searchText ILIKE '% ' || currentTag || ' %')" +
|
||||
"))))"
|
||||
)
|
||||
Page<WidgetTypeInfoEntity> findSystemWidgetTypes(@Param("systemTenantId") UUID systemTenantId,
|
||||
@Param("searchText") String searchText,
|
||||
@ -57,13 +72,29 @@ public interface WidgetTypeInfoRepository extends JpaRepository<WidgetTypeInfoEn
|
||||
"AND ((:widgetTypesEmpty) IS TRUE OR wti.widget_type IN (:widgetTypes)) " +
|
||||
"AND (wti.name ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR ((:fullSearch) IS TRUE AND (wti.description ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR lower(wti.tags\\:\\:text)\\:\\:text[] && string_to_array(lower(:searchText), ' '))))",
|
||||
"OR EXISTS (" +
|
||||
"SELECT 1 " +
|
||||
"FROM unnest(wti.tags) AS currentTag " +
|
||||
"WHERE :searchText ILIKE '%' || currentTag || '%' " +
|
||||
"AND (length(:searchText) = length(currentTag) " +
|
||||
"OR :searchText ILIKE currentTag || ' %' " +
|
||||
"OR :searchText ILIKE '% ' || currentTag " +
|
||||
"OR :searchText ILIKE '% ' || currentTag || ' %')" +
|
||||
"))))",
|
||||
countQuery = "SELECT count(*) FROM widget_type_info_view wti WHERE wti.tenant_id IN (:tenantId, :nullTenantId) " +
|
||||
"AND ((:deprecatedFilterEnabled) IS FALSE OR wti.deprecated = :deprecatedFilter) " +
|
||||
"AND ((:widgetTypesEmpty) IS TRUE OR wti.widget_type IN (:widgetTypes)) " +
|
||||
"AND (wti.name ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR ((:fullSearch) IS TRUE AND (wti.description ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR lower(wti.tags\\:\\:text)\\:\\:text[] && string_to_array(lower(:searchText), ' '))))"
|
||||
"OR EXISTS (" +
|
||||
"SELECT 1 " +
|
||||
"FROM unnest(wti.tags) AS currentTag " +
|
||||
"WHERE :searchText ILIKE '%' || currentTag || '%' " +
|
||||
"AND (length(:searchText) = length(currentTag) " +
|
||||
"OR :searchText ILIKE currentTag || ' %' " +
|
||||
"OR :searchText ILIKE '% ' || currentTag " +
|
||||
"OR :searchText ILIKE '% ' || currentTag || ' %')" +
|
||||
"))))"
|
||||
)
|
||||
Page<WidgetTypeInfoEntity> findAllTenantWidgetTypesByTenantId(@Param("tenantId") UUID tenantId,
|
||||
@Param("nullTenantId") UUID nullTenantId,
|
||||
@ -81,13 +112,29 @@ public interface WidgetTypeInfoRepository extends JpaRepository<WidgetTypeInfoEn
|
||||
"AND ((:widgetTypesEmpty) IS TRUE OR wti.widget_type IN (:widgetTypes)) " +
|
||||
"AND (wti.name ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR ((:fullSearch) IS TRUE AND (wti.description ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR lower(wti.tags\\:\\:text)\\:\\:text[] && string_to_array(lower(:searchText), ' '))))",
|
||||
"OR EXISTS (" +
|
||||
"SELECT 1 " +
|
||||
"FROM unnest(wti.tags) AS currentTag " +
|
||||
"WHERE :searchText ILIKE '%' || currentTag || '%' " +
|
||||
"AND (length(:searchText) = length(currentTag) " +
|
||||
"OR :searchText ILIKE currentTag || ' %' " +
|
||||
"OR :searchText ILIKE '% ' || currentTag " +
|
||||
"OR :searchText ILIKE '% ' || currentTag || ' %')" +
|
||||
"))))",
|
||||
countQuery = "SELECT count(*) FROM widget_type_info_view wti WHERE wti.tenant_id = :tenantId " +
|
||||
"AND ((:deprecatedFilterEnabled) IS FALSE OR wti.deprecated = :deprecatedFilter) " +
|
||||
"AND ((:widgetTypesEmpty) IS TRUE OR wti.widget_type IN (:widgetTypes)) " +
|
||||
"AND (wti.name ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR ((:fullSearch) IS TRUE AND (wti.description ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR lower(wti.tags\\:\\:text)\\:\\:text[] && string_to_array(lower(:searchText), ' '))))"
|
||||
"OR EXISTS (" +
|
||||
"SELECT 1 " +
|
||||
"FROM unnest(wti.tags) AS currentTag " +
|
||||
"WHERE :searchText ILIKE '%' || currentTag || '%' " +
|
||||
"AND (length(:searchText) = length(currentTag) " +
|
||||
"OR :searchText ILIKE currentTag || ' %' " +
|
||||
"OR :searchText ILIKE '% ' || currentTag " +
|
||||
"OR :searchText ILIKE '% ' || currentTag || ' %')" +
|
||||
"))))"
|
||||
)
|
||||
Page<WidgetTypeInfoEntity> findTenantWidgetTypesByTenantId(@Param("tenantId") UUID tenantId,
|
||||
@Param("searchText") String searchText,
|
||||
@ -111,7 +158,15 @@ public interface WidgetTypeInfoRepository extends JpaRepository<WidgetTypeInfoEn
|
||||
"AND ((:widgetTypesEmpty) IS TRUE OR wti.widget_type IN (:widgetTypes)) " +
|
||||
"AND (wti.name ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR ((:fullSearch) IS TRUE AND (wti.description ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR lower(wti.tags\\:\\:text)\\:\\:text[] && string_to_array(lower(:searchText), ' ')))) " +
|
||||
"OR EXISTS (" +
|
||||
"SELECT 1 " +
|
||||
"FROM unnest(wti.tags) AS currentTag " +
|
||||
"WHERE :searchText ILIKE '%' || currentTag || '%' " +
|
||||
"AND (length(:searchText) = length(currentTag) " +
|
||||
"OR :searchText ILIKE currentTag || ' %' " +
|
||||
"OR :searchText ILIKE '% ' || currentTag " +
|
||||
"OR :searchText ILIKE '% ' || currentTag || ' %')" +
|
||||
")))) " +
|
||||
"ORDER BY wbw.widget_type_order",
|
||||
countQuery = "SELECT count(*) FROM widget_type_info_view wti, widgets_bundle_widget wbw " +
|
||||
"WHERE wbw.widgets_bundle_id = :widgetsBundleId " +
|
||||
@ -120,7 +175,15 @@ public interface WidgetTypeInfoRepository extends JpaRepository<WidgetTypeInfoEn
|
||||
"AND ((:widgetTypesEmpty) IS TRUE OR wti.widget_type IN (:widgetTypes)) " +
|
||||
"AND (wti.name ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR ((:fullSearch) IS TRUE AND (wti.description ILIKE CONCAT('%', :searchText, '%') " +
|
||||
"OR lower(wti.tags\\:\\:text)\\:\\:text[] && string_to_array(lower(:searchText), ' '))))"
|
||||
"OR EXISTS (" +
|
||||
"SELECT 1 " +
|
||||
"FROM unnest(wti.tags) AS currentTag " +
|
||||
"WHERE :searchText ILIKE '%' || currentTag || '%' " +
|
||||
"AND (length(:searchText) = length(currentTag) " +
|
||||
"OR :searchText ILIKE currentTag || ' %' " +
|
||||
"OR :searchText ILIKE '% ' || currentTag " +
|
||||
"OR :searchText ILIKE '% ' || currentTag || ' %')" +
|
||||
"))))"
|
||||
)
|
||||
Page<WidgetTypeInfoEntity> findWidgetTypesInfosByWidgetsBundleId(@Param("widgetsBundleId") UUID widgetsBundleId,
|
||||
@Param("searchText") String searchText,
|
||||
|
||||
@ -46,7 +46,15 @@ public interface WidgetsBundleRepository extends JpaRepository<WidgetsBundleEnti
|
||||
"WHERE wtd.id = wbw.widget_type_id " +
|
||||
"AND (wtd.name ILIKE CONCAT('%', :textSearch, '%') " +
|
||||
"OR wtd.description ILIKE CONCAT('%', :textSearch, '%') " +
|
||||
"OR lower(wtd.tags\\:\\:text)\\:\\:text[] && string_to_array(lower(:textSearch), ' '))))",
|
||||
"OR EXISTS (" +
|
||||
"SELECT 1 " +
|
||||
"FROM unnest(wtd.tags) AS currentTag " +
|
||||
"WHERE :searchText ILIKE '%' || currentTag || '%' " +
|
||||
"AND (length(:searchText) = length(currentTag) " +
|
||||
"OR :searchText ILIKE currentTag || ' %' " +
|
||||
"OR :searchText ILIKE '% ' || currentTag " +
|
||||
"OR :searchText ILIKE '% ' || currentTag || ' %')" +
|
||||
"))))",
|
||||
countQuery = "SELECT count(*) FROM widgets_bundle wb WHERE wb.tenant_id = :systemTenantId " +
|
||||
"AND (wb.title ILIKE CONCAT('%', :textSearch, '%') " +
|
||||
"OR wb.description ILIKE CONCAT('%', :textSearch, '%') " +
|
||||
@ -54,7 +62,15 @@ public interface WidgetsBundleRepository extends JpaRepository<WidgetsBundleEnti
|
||||
"WHERE wtd.id = wbw.widget_type_id " +
|
||||
"AND (wtd.name ILIKE CONCAT('%', :textSearch, '%') " +
|
||||
"OR wtd.description ILIKE CONCAT('%', :textSearch, '%') " +
|
||||
"OR lower(wtd.tags\\:\\:text)\\:\\:text[] && string_to_array(lower(:textSearch), ' '))))"
|
||||
"OR EXISTS (" +
|
||||
"SELECT 1 " +
|
||||
"FROM unnest(wtd.tags) AS currentTag " +
|
||||
"WHERE :searchText ILIKE '%' || currentTag || '%' " +
|
||||
"AND (length(:searchText) = length(currentTag) " +
|
||||
"OR :searchText ILIKE currentTag || ' %' " +
|
||||
"OR :searchText ILIKE '% ' || currentTag " +
|
||||
"OR :searchText ILIKE '% ' || currentTag || ' %')" +
|
||||
"))))"
|
||||
)
|
||||
Page<WidgetsBundleEntity> findSystemWidgetsBundlesFullSearch(@Param("systemTenantId") UUID systemTenantId,
|
||||
@Param("textSearch") String textSearch,
|
||||
@ -81,7 +97,15 @@ public interface WidgetsBundleRepository extends JpaRepository<WidgetsBundleEnti
|
||||
"WHERE wtd.id = wbw.widget_type_id " +
|
||||
"AND (wtd.name ILIKE CONCAT('%', :textSearch, '%') " +
|
||||
"OR wtd.description ILIKE CONCAT('%', :textSearch, '%') " +
|
||||
"OR lower(wtd.tags\\:\\:text)\\:\\:text[] && string_to_array(lower(:textSearch), ' '))))",
|
||||
"OR EXISTS (" +
|
||||
"SELECT 1 " +
|
||||
"FROM unnest(wtd.tags) AS currentTag " +
|
||||
"WHERE :searchText ILIKE '%' || currentTag || '%' " +
|
||||
"AND (length(:searchText) = length(currentTag) " +
|
||||
"OR :searchText ILIKE currentTag || ' %' " +
|
||||
"OR :searchText ILIKE '% ' || currentTag " +
|
||||
"OR :searchText ILIKE '% ' || currentTag || ' %')" +
|
||||
"))))",
|
||||
countQuery = "SELECT count(*) FROM widgets_bundle wb WHERE wb.tenant_id IN (:tenantId, :nullTenantId) " +
|
||||
"AND (wb.title ILIKE CONCAT('%', :textSearch, '%') " +
|
||||
"OR wb.description ILIKE CONCAT('%', :textSearch, '%') " +
|
||||
@ -89,7 +113,15 @@ public interface WidgetsBundleRepository extends JpaRepository<WidgetsBundleEnti
|
||||
"WHERE wtd.id = wbw.widget_type_id " +
|
||||
"AND (wtd.name ILIKE CONCAT('%', :textSearch, '%') " +
|
||||
"OR wtd.description ILIKE CONCAT('%', :textSearch, '%') " +
|
||||
"OR lower(wtd.tags\\:\\:text)\\:\\:text[] && string_to_array(lower(:textSearch), ' '))))"
|
||||
"OR EXISTS (" +
|
||||
"SELECT 1 " +
|
||||
"FROM unnest(wtd.tags) AS currentTag " +
|
||||
"WHERE :searchText ILIKE '%' || currentTag || '%' " +
|
||||
"AND (length(:searchText) = length(currentTag) " +
|
||||
"OR :searchText ILIKE currentTag || ' %' " +
|
||||
"OR :searchText ILIKE '% ' || currentTag " +
|
||||
"OR :searchText ILIKE '% ' || currentTag || ' %')" +
|
||||
"))))"
|
||||
)
|
||||
Page<WidgetsBundleEntity> findAllTenantWidgetsBundlesByTenantIdFullSearch(@Param("tenantId") UUID tenantId,
|
||||
@Param("nullTenantId") UUID nullTenantId,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user