Skip to content

Commit

Permalink
[BUGFIX] Ensure proper items per page setting
Browse files Browse the repository at this point in the history
If Solr is initialized with an empty query (initializeWithEmptyQuery)
usedResultsPerPage is empty and will lead to an exception. To avoid
this the default configuration from TypoScript is used.

Resolves: TYPO3-Solr#3150
  • Loading branch information
dkd-friedrich committed Mar 9, 2022
1 parent 04b3ffb commit 1de4d32
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Classes/Controller/SearchController.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public function resultsAction(): ResponseInterface
$this->controllerContext->setSearchResultSet($searchResultSet);

$currentPage = $this->request->hasArgument('page') ? (int)$this->request->getArgument('page') : 1;
$itemsPerPage = $searchResultSet->getUsedResultsPerPage();
$itemsPerPage = ($searchResultSet->getUsedResultsPerPage() ?: $this->typoScriptConfiguration->getSearchResultsPerPage(10));
$paginator = GeneralUtility::makeInstance(ResultsPaginator::class, $searchResultSet, $currentPage, $itemsPerPage);
$pagination = GeneralUtility::makeInstance(ResultsPagination::class, $paginator);
$pagination->setMaxPageNumbers((int)$this->typoScriptConfiguration->getMaxPaginatorLinks(0));
Expand Down

0 comments on commit 1de4d32

Please sign in to comment.