Wordpress / WoOCommerce更改search-slug:想要搜索/显示特定自定义类型的结果

Search is set via Relevanssi plugin to only search for the custom type "brands". However, using this code beneath to change the url slug makes it search everything except custom types. How can I alter the code to search specifically in the "brands" custom type?

function change_sok_url() {
    if ( is_search() && ! empty( $_GET['s'] ) ) {
        wp_redirect( home_url( "/sok/" ) . urlencode( get_query_var( 's' ) ) );
        exit();
    }
}
add_action( 'template_redirect', 'change_sok_url' );

function rewrite_sok_slug() {
    add_rewrite_rule(
        'sok(/([^/]+))?(/([^/]+))?(/([^/]+))?/?',
        'index.php?s=$matches[2]&paged=$matches[6]',
         'top'
    );
}
add_action( 'init', 'rewrite_sok_slug' );