You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@airavata.apache.org by "lahirujayathilake (via GitHub)" <gi...@apache.org> on 2025/06/16 14:17:20 UTC

Re: [PR] Support better text search [airavata]

lahirujayathilake commented on code in PR #520:
URL: https://github.com/apache/airavata/pull/520#discussion_r2150122287


##########
modules/research-framework/research-service/src/main/java/org/apache/airavata/research/service/model/repo/ResourceRepository.java:
##########
@@ -31,31 +31,44 @@
 @Repository
 public interface ResourceRepository extends JpaRepository<Resource, String> {
 
-    @Query("SELECT r FROM #{#entityName} r WHERE TYPE(r) IN :types")
-    Page<Resource> findAllByTypes(@Param("types") List<Class<? extends Resource>> types, Pageable pageable);
+    @Query(
+            """
+            SELECT r
+            FROM #{#entityName} r
+            WHERE TYPE(r) IN :types AND r.name LIKE CONCAT('%', :nameSearch, '%')
+            ORDER BY r.name
+            """)
+    Page<Resource> findAllByTypes(
+            @Param("types") List<Class<? extends Resource>> types,
+            @Param("nameSearch") String nameSearch,
+            Pageable pageable);
 
     @Query(
             """
-    SELECT r
-    FROM Resource r
-    JOIN r.tags t
-    WHERE r.class IN :typeList AND t.value IN :tags
-    GROUP BY r
-    HAVING COUNT(DISTINCT t.value) = :tagCount
-    """)
+            SELECT r
+            FROM Resource r
+            JOIN r.tags t
+            WHERE r.class IN :typeList
+              AND t.value IN :tags
+              AND r.name LIKE CONCAT('%', :nameSearch, '%')

Review Comment:
   @ganning127, can we convert to lower-case and check similar to line 70



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@airavata.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org