Skip to content

Commit

Permalink
fix bug with search people with symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
2or5 committed Sep 26, 2023
1 parent 252708d commit b0c1bc4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions dao/src/main/java/greencity/repository/UserRepo.java
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,8 @@ public interface UserRepo extends JpaRepository<User, Long>, JpaSpecificationExe
+ " SELECT user_id AS id FROM users_friends WHERE friend_id = :userId AND status = 'FRIEND' "
+ " UNION "
+ " SELECT friend_id AS id FROM users_friends WHERE user_id = :userId AND status = 'FRIEND' "
+ ") AND LOWER(u.name) LIKE LOWER(CONCAT('%', :filteringName, '%')) ")
+ ") AND LOWER(u.name) LIKE LOWER(CONCAT('%', REPLACE(REPLACE(REPLACE(REPLACE(:filteringName, '&', '\\&'), "
+ "'%', '\\%'), '_', '\\_'), '#', '\\#'), '%')) ")
Page<User> getAllUsersExceptMainUserAndFriends(Long userId, String filteringName, Pageable pageable);

/**
Expand Down Expand Up @@ -316,4 +317,4 @@ public interface UserRepo extends JpaRepository<User, Long>, JpaSpecificationExe
+ " SELECT friend_id AS id FROM users_friends WHERE user_id = :userId AND status = 'FRIEND' "
+ ") AND LOWER(u.name) LIKE LOWER(CONCAT('%', :filteringName, '%'))")
Page<User> findAllFriendsOfUser(Long userId, String filteringName, Pageable pageable);
}
}

0 comments on commit b0c1bc4

Please sign in to comment.