alkacon/opencms-core

Pagination for lists is missing when maxReturnedResults is -1

AnnJul opened this issue · 1 comments

When the maximal number of results should be unlimited "maxNumResults" should be -1.
For the search results it works fine. The class CmsSolrIndex returns Integer.MAX_VALUE if maxNumResults is < 0 and all results will be shown.
For the pagination we check ${search.numPages} > 1 (CmsSearchResultsWrapper.java) in our jsp. This returns -1 and the pagination is missing.

/**
     * @see org.opencms.jsp.search.result.I_CmsSearchResultWrapper#getNumPages()
     */
    @Override
    public int getNumPages() {
        return m_solrResultList == null ? 1 : m_controller.getPagination().getConfig().getNumPages(getNumMaxReturned());
    }

/**
     * @see org.opencms.jsp.search.result.I_CmsSearchResultWrapper#getNumMaxReturned()
     */
public long getNumMaxReturned() {
        long maxReturnedResults = Integer.valueOf(
            m_controller.getCommon().getConfig().getMaxReturnedResults()).longValue();
        return (maxReturnedResults >= 0) && (maxReturnedResults > getNumFound()) ? getNumFound() : maxReturnedResults;
 }

OpenCms Version 14

Fixed in master branch.