fix search by tags + make it case insensitive
@@ -49,7 +49,9 @@ public interface EcoNewsRepo extends JpaRepository<EcoNews, Long> {
* @return list of {@link EcoNews}
*/
@Query("select en from EcoNews as en "
- + "where en.title like CONCAT('%', :searchQuery, '%') "
- + "or en.text like CONCAT('%', :searchQuery, '%')")
+ + "where lower(en.title) like lower(CONCAT('%', :searchQuery, '%')) "
+ + "or lower(en.text) like lower(CONCAT('%', :searchQuery, '%')) "
+ + "or en.id in (select en.id from EcoNews en inner join en.tags entags "
+ + "where lower(entags.name) like lower(CONCAT('%', :searchQuery, '%')))")
Page<EcoNews> searchEcoNews(Pageable pageable, String searchQuery);
}
