I have the following code to do the search for the consedoc field, but I see that it does not search but rather tells me the number of records
public static Specification<Solicitud>likeConsedoc(String consedoc){
if(consedoc.isEmpty() || consedoc.isBlank() || consedoc==null) { //carga todos los datos inicialmente sin filtrar
System.out.println("Consedoc null or empty");
return (root, query, criteriaBuilder)-> criteriaBuilder.isTrue(criteriaBuilder.literal(true));
}
return (root, query, criteriaBuilder)->
criteriaBuilder.like(root.get(Solicitud_.CONSEDOC), "%"+consedoc+"%");
}
In the logs I can see the query being executed and I can see the count clause which is not what I want.
select count(solicitud0_.id) as col_0_0_ from patrimonio.solicitud_usuario solicitud0_ where solicitud0_.consedoc like ?
I did the test with postman and it does not return any record enter image description here
Can someone help me, or suggest me to use to filter the data from my front end. I am using Angular and I am doing the pagination and filtering in the backend with Spring Boot
Truth is, I hadn't noticed that. With this I see that the backend is working fine. But in the frontend if I have a failure it does not show me the searched records it only shows me the total enter image description here
Spring Pagination starts with page 0. By passing in pageNumber=1, pageSize=15 you are telling Spring to skip the first 15 results - since there is only 1 result for this query, you get 0 results displayed. This information is contained in the returning results where it tells you there was 1 totalElements, 1 page in total, and there are no more records after this one.