SearchService.php: default to all boards

This commit is contained in:
Zankaria 2025-05-23 23:21:12 +02:00
parent 47940c66e9
commit e0bc50edd7

View file

@ -37,7 +37,7 @@ class SearchService {
private float $max_weight;
private int $max_query_length;
private int $post_limit;
private array $searchable_board_uris;
private ?array $searchable_board_uris;
private static function truncateQuery(string $text, int $byteLimit): ?string {
@ -249,7 +249,7 @@ class SearchService {
* @param float $max_weight The maximum weight of the parsed user query. Body filters that go beyond this limit are discarded.
* @param int $max_query_length Maximum length of the raw input query before it's truncated.
* @param int $post_limit Maximum number of results.
* @param array $searchable_board_uris The uris of the board that can be searched.
* @param ?array $searchable_board_uris The uris of the board that can be searched. Null to search all the boards.
*/
public function __construct(
LogDriver $log,
@ -344,7 +344,8 @@ class SearchService {
return [];
}
if (!\in_array($board, $this->searchable_board_uris)) {
$uris = $this->searchable_board_uris ?? listBoards(true);
if (!\in_array($board, $uris)) {
return [];
}