You should be able to use pre_get_posts
to change the query. I’d suggest creating a custom plugin, so that if you ever change your theme your modifications will still apply.
To get you started, here’s how you can set the post types being searched:
function search_filter($query) {
if ( !is_admin() && $query->is_main_query() ) {
if ($query->is_search) {
$query->set('post_type', array( 'post' ) );
}
}
}
add_action('pre_get_posts','search_filter');
You would continue to add $query->set
statements inside the conditionals to further customize what fields to search.
One other option would be to write a completely custom query and call that from your search rather than using WP’s built-in query. You might want to benchmark that solution to see whether it is any faster than the pre_get_posts
way.