BeforeSearchInDatabaseRecordProviderEvent 

In some individual cases it may not be desirable to search in a specific table. Therefore, the PSR-14 event \TYPO3\CMS\Backend\Search\Event\BeforeSearchInDatabaseRecordProviderEvent is available, which allows to exclude / ignore such tables by adding them to a deny list. Additionally, the PSR-14 event can be used to restrict the search result on certain page IDs or to modify the search query altogether.

Example: Exclude a table from the live search 

EXT:my_extension/Classes/Backend/EventListener/MyEventListener.php
<?php

declare(strict_types=1);

namespace MyVendor\MyExtension\Backend\EventListener;

use TYPO3\CMS\Backend\Search\Event\BeforeSearchInDatabaseRecordProviderEvent;
use TYPO3\CMS\Core\Attribute\AsEventListener;

#[AsEventListener(
  identifier: 'my-extension/before-search-in-database-record-provider',
)]
final readonly class MyEventListener
{
  public function __invoke(BeforeSearchInDatabaseRecordProviderEvent $event): void
  {
    $event->ignoreTable('my_custom_table');
  }
}
Copied!

API 

final class BeforeSearchInDatabaseRecordProviderEvent
Fully qualified name
\TYPO3\CMS\Backend\Search\Event\BeforeSearchInDatabaseRecordProviderEvent

PSR-14 event to modify the incoming input about which tables should be searched for within the live search results. This allows adding additional DB tables to be excluded / ignored, to further limit the search result on certain page IDs or to modify the search query altogether.

getSearchPageIds()
Returns
array
setSearchPageIds(array $searchPageIds)
param $searchPageIds

the searchPageIds

getSearchDemand()
Returns
\TYPO3\CMS\Backend\Search\LiveSearch\SearchDemand\SearchDemand
setSearchDemand(\TYPO3\CMS\Backend\Search\LiveSearch\SearchDemand\SearchDemand $searchDemand)
param $searchDemand

the searchDemand

ignoreTable(string $table)
param $table

the table

setIgnoredTables(array $tables)
param $tables

the tables

isTableIgnored(string $table)
param $table

the table

Returns
bool
getIgnoredTables()
Returns
string[]