forked from leftypol/leftypol
search.php: handle query too broad error
This commit is contained in:
parent
1723db32a6
commit
c9610bb237
1 changed files with 4 additions and 3 deletions
|
|
@ -26,7 +26,6 @@ if (isset($_GET['search']) && !empty($_GET['search'])) {
|
||||||
$filters = $search_service->reduceAndWeight($parse_res);
|
$filters = $search_service->reduceAndWeight($parse_res);
|
||||||
$search_res = $search_service->search($ip, $raw_search, $filters, $fallback_board);
|
$search_res = $search_service->search($ip, $raw_search, $filters, $fallback_board);
|
||||||
|
|
||||||
|
|
||||||
// Needed to set a global variable further down the stack, plus the template.
|
// Needed to set a global variable further down the stack, plus the template.
|
||||||
$actual_board = $filters->board ?? $fallback_board;
|
$actual_board = $filters->board ?? $fallback_board;
|
||||||
|
|
||||||
|
|
@ -36,7 +35,9 @@ if (isset($_GET['search']) && !empty($_GET['search'])) {
|
||||||
'search' => \str_replace('"', '"', utf8tohtml($_GET['search']))
|
'search' => \str_replace('"', '"', utf8tohtml($_GET['search']))
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (empty($search_res)) {
|
if ($search_res === null) {
|
||||||
|
$body .= '<hr/><p style="text-align:center" class="unimportant">(' . _('Query too broad.') . ')</p>';
|
||||||
|
} elseif (empty($search_res)) {
|
||||||
$body .= '<hr/><p style="text-align:center" class="unimportant">(' . _('No results.') . ')</p>';
|
$body .= '<hr/><p style="text-align:center" class="unimportant">(' . _('No results.') . ')</p>';
|
||||||
} else {
|
} else {
|
||||||
$body .= '<hr/>';
|
$body .= '<hr/>';
|
||||||
|
|
@ -70,5 +71,5 @@ if (isset($_GET['search']) && !empty($_GET['search'])) {
|
||||||
echo Element('page.html', Array(
|
echo Element('page.html', Array(
|
||||||
'config'=>$config,
|
'config'=>$config,
|
||||||
'title'=> _('Search'),
|
'title'=> _('Search'),
|
||||||
'body'=>'' . $body
|
'body'=> $body
|
||||||
));
|
));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue