How can I disable the cache for a specific page or have the cache ignore query params?
After a lot of trying and retrying I settled on the following solution
function mythemename_preprocess_page(&amp;$variables)
{
  if(isset($_SERVER['QUERY_STRING'])) {
    $params = \GuzzleHttp\Psr7\parse_query($_SERVER['QUERY_STRING']);
    if(isset($params['keys']) &amp;&amp; strlen($params['keys']) &gt; 0 &amp;&amp; preg_match('#^/search#', $_SERVER['REQUEST_URI'])) {
      \Drupal::service('page_cache_kill_switch')-&gt;trigger();
    }
  }
}

As far as I can tell, this stops the cache from working if the request is on the search page and there is a query parameter present named keys