Extending wordpress search to include excerpts and taxonomies?

With WordPress 4.2.2 I’m using the following (admittedly fragile) method to search excerpts as well as the content and title without a plugin.

This is the relevant snippet from functions.php.

add_filter('posts_where', 'custom_posts_where');

function custom_posts_where($where) {
    if (is_search()) {
        $where = preg_replace(
            "/(\w+).post_title LIKE ('%.*?%')/",
            "$1.post_title LIKE $2) OR ($1.post_excerpt LIKE $2",
            $where);
    }

return $where;
}