Theres a way to use `$query->set('tax_query', ...)` in `pre_get_posts` filter? for example next code is not altering the query. Note that I'm building $taxonomies from and custom search.

```
function custom_search_filter($query) {
        ...

        // array('taxonomy' => 'category', 'field' => 'id', 'terms' => array( 41,42 ), 'operator' => 'IN')
        $taxonomies = implode(',', $taxonomy_arr);

        // https://wordpress.stackexchange.com/questions/25076/how-to-filter-wordpress-search-excluding-post-in-some-custom-taxonomies

        $taxonomy_query = array('relation' => 'AND', $taxonomies);

        $query->set('tax_query', $taxonomy_query);
    }

    return $query; 
}

add_filter( 'pre_get_posts', 'custom_search_filter', 999 );

```

Thanks in advance.