diff --git a/config/app.php.txt b/config/app.php.txt index 1ab272c..fa392e1 100644 --- a/config/app.php.txt +++ b/config/app.php.txt @@ -50,10 +50,16 @@ error_reporting(E_ALL); define('WEBSITE_DOMAIN', (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http') . '://' . (!empty($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '')); /* - * Search results per page before show the read more link. + * Page search results before show the read more link. * */ -define('WEBSITE_PAGINATION_SEARCH_RESULTS_LIMIT', 100); +define('WEBSITE_PAGINATION_SEARCH_PAGE_RESULTS_LIMIT', 100); + +/* + * Image search results before show the read more link. + * + */ +define('WEBSITE_PAGINATION_SEARCH_IMAGE_RESULTS_LIMIT', 10); /* * Save ident icons to the static webp cache (placed in storage/cache) to prevent CPU overload diff --git a/public/search.php b/public/search.php index 3c54571..401b404 100644 --- a/public/search.php +++ b/public/search.php @@ -108,15 +108,15 @@ if (filter_var($q, FILTER_VALIDATE_URL) && preg_match(CRAWL_URL_REGEXP, $q)) { // Search request if (!empty($q)) { - if (!empty($t) && $t == 'image') { + if ($t == 'image') { $resultsTotal = $sphinx->searchHostImagesTotal(Filter::searchQuery($q, $m)); - $results = $sphinx->searchHostImages(Filter::searchQuery($q, $m), $p * WEBSITE_PAGINATION_SEARCH_RESULTS_LIMIT - WEBSITE_PAGINATION_SEARCH_RESULTS_LIMIT, WEBSITE_PAGINATION_SEARCH_RESULTS_LIMIT, $resultsTotal); + $results = $sphinx->searchHostImages(Filter::searchQuery($q, $m), $p * WEBSITE_PAGINATION_SEARCH_IMAGE_RESULTS_LIMIT - WEBSITE_PAGINATION_SEARCH_IMAGE_RESULTS_LIMIT, WEBSITE_PAGINATION_SEARCH_IMAGE_RESULTS_LIMIT, $resultsTotal); } else { $resultsTotal = $sphinx->searchHostPagesTotal(Filter::searchQuery($q, $m)); - $results = $sphinx->searchHostPages(Filter::searchQuery($q, $m), $p * WEBSITE_PAGINATION_SEARCH_RESULTS_LIMIT - WEBSITE_PAGINATION_SEARCH_RESULTS_LIMIT, WEBSITE_PAGINATION_SEARCH_RESULTS_LIMIT, $resultsTotal); + $results = $sphinx->searchHostPages(Filter::searchQuery($q, $m), $p * WEBSITE_PAGINATION_SEARCH_PAGE_RESULTS_LIMIT - WEBSITE_PAGINATION_SEARCH_PAGE_RESULTS_LIMIT, WEBSITE_PAGINATION_SEARCH_PAGE_RESULTS_LIMIT, $resultsTotal); } } else { @@ -297,7 +297,7 @@ if (!empty($q)) {

- +
@@ -310,8 +310,7 @@ if (!empty($q)) { - getFoundHostImage($result->id)) { ?> + getFoundHostImage($result->id)) { ?> - +
- +