Searching within given categories/taxonomy terms only
On the Advanced Options -> Exclude results panel, with the Include posts only from selected categories/taxonomy terms option.
If you also want to exclude posts which are uncategorized or not connected with any terms, then go to the Frontend Search Settings -> Advanced panel and turn off the Show posts/CPM with empty taxonomy terms? option
Using this custom code in your active themes functions.php file:
Make sure to change the $include variable as instructed to the desired taxonomy terms.