If you want to force the search engine to search only within a specific post type, then all you have to do is simply copy and paste the following code into your theme’s functions.php file. Remember to change the post type name on line 4 and you are done.

Snippet Source/Credit: Hongkiat