The ideal flow for not finding an item is:
- Search item > Item not found > Enter new item
The toggle solution works but adds an extra step:
- Search item > Item not found > Toggle to create > Enter new item
Or potentially even more steps if the user assumes wrongly the item does not exist:
- Toggle to create > Enter new item > New item exists > Toggle to search > Search item > Item is found
One solution that respects the ideal flow is searching first and provide an option to enter a new item regardless if there are suitable results, no suitable results or no results at all.
This is assuming you have an item detail page as well as a create new item page:
Consider looking at Google Drive's Sharing modal, where multiple emails can be added from either a suggestion match or created new. The entry field ignores spaces when the entry is not an email. If the user enters an email and presses ENTER or SPACE, it is added as a new entry. Note that there is no intermediate step of pressing an interface button to create the new contact.
Lastly, the solution is dependent on your application and needs (which was not provided in the question). We don't know what we are searching, for what, whether the items are emails or are linked to detail pages with alot more details, etc.