How to exclude certain products from the search?

To exclude certain products from the search you can use catalog visibility option. Catalog visibility is native WooCommerce feature. Go to the product edit page and find the Catalog visibility option in the Publish widget.