If offline search is supported
Search locally, and show offline message.
Showing offline results only. Restore internet connection to see all results.
This reminds me of how the default Windows 10 email client works:
- The most recent of your emails are stored locally on your machine, so those messages don't require internet connectivity to read or search.
- Searching, by default, only scans your local machine. If the message you're requesting is not on your local machine, you can initiate an online search with the same criteria, using the "Search online" button at the bottom (I'll admit... That "Search online" text does not look like an action, but that's another topic).
To apply this pattern to your situation, you'd do without the "Search online" button, and just include the message explaining that online results are currently unavailable.
If offline search is NOT supported
Show offline message next to disabled search button.
The search input field isn't broken, so there is no need to prevent the user from typing a search query. This would allow the user to enter a query she would like to pursue once connectivity is restored.
Personal anecdote: I used to use Skype for business while working in a building with spotty WiFi. It would disconnect for just a couple seconds at a time, but during that period, all IM chat windows would have their input areas disabled. This inevitably led to messages like: "Just letting you know I'll be leavbit early today."
The search action is broken, so you should disable the search button. Notify the user as to why the search is disabled so she does not keep trying to trigger a search. An enabled button that does nothing is wrong.
If this search pulls results as the user types, then instead of results, show a message explaining the lack of results, and a button to retry the search (useful for when connectivity is restored, or for particularly stubborn users).