on ‎2021 Mar 11 4:24 PM
Hi everyone, I built this function to retrieve Products in a Wishlist given UserId and Wishlist code and pagination.
I used paginatedFlexibleSearchService like this but I couldn't get any result:
@Override
public List<ProductModel> findPaginatedProductsInWishlistByUserIdAndProductCode(final String userId, final String code, final SearchPageData<ProductModel> searchPageData)
{
StringBuilder query = new StringBuilder();
query.append("select {p.PK} "
+ "FROM{ "
+ "Wishlist2Product as w2p "
+ "JOIN Product as p ON {p.pk} = {w2p.target} "
+ "JOIN Wishlist as w ON {w.pk} = {w2p.source} "
+ "JOIN User as u ON {u.pk} = {w.user} "
+ "} "
+ "WHERE {w.code} = ?code "
+ "AND {u.uid} = ?userId ");
FlexibleSearchQuery fQuery = new FlexibleSearchQuery(query);
fQuery.addQueryParameter("userId", userId);
fQuery.addQueryParameter("code", code);
fQuery.setResultClassList(Arrays.asList(ProductModel.class));
PaginatedFlexibleSearchParameter parameter = new PaginatedFlexibleSearchParameter();
parameter.setFlexibleSearchQuery(fQuery);
parameter.setSearchPageData(searchPageData);
SearchPageData<ProductModel> search = paginatedFlexibleSearchService
.search(parameter);
return search.getResults();
}
I tried the normal FlexibleSearchService and I got all the results I needed, also using Hac FlexibleSearch.
What did I do wrong?
Also, I populated searchPageData in this way:
SearchPageData<ProductModel> searchPageData = PaginatedSearchUtils.createSearchPageDataWithPagination(pageSize,currentPage, true);
Thanks everyone for the attention.
Request clarification before answering.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.