Programmatically executing a node search Is it possible to programmatically execute a node search? Maybe via NodeSearch or Drupal\search?

The closest I could get was to programmatically do stuff such as:

\Drupal::service('search.index')-&gt;clear();

echo \Drupal::service('plugin.manager.search')-&gt;getCacheMaxAge();


Note that I don't want to use search_api but simply what Drupal 8 provides out of the box as a response to /search/node?keys=test. Also note that I don't wish to integrate via HTTP.
You can achieve that with the search plugin used by the search page entity with the node_search id.
    

use Drupal\search\Entity\SearchPage;

// Default is the node_search page.
$id = \Drupal::service('search.search_page_repository')-&gt;getDefaultSearchPage();
$defaultSearchPage = SearchPage::load($id);
$searchPlugin = $defaultSearchPage-&gt;getPlugin();
$searchPlugin-&gt;setSearch($keywords, $parameters, $arguments);
$searchPlugin-&gt;buildResults(); // $searchPlugin-&gt;execute() works too if you want raw results