Add link to excerpt if is on search and is custom post type

I want to display the excerpt and add a link to the bottom if the searched result if from my custom post type. What filter should I use?

if ( is_search() && get_post_type() == 'books' ) {          function exceprt_link( $  search_excerpt ) {         $  added_link = "<br><a href='https://google.com'>Go to google</a>";                  $  new_excerpt = $  search_excerpt . $  added_link;                  return $  new_excerpt;              }     add_filter( 'the_excerpt', 'exceprt_link' );      }