As you may have discovered, in spite of its phenomenal performance as a blogging platform/CMS, WordPress falls woefully short in the search department. There are other plugins available that will improve your search results, like Amazon CloudSearch in WordPress with Lift or SearchWP. But for those of you who don’t want to install 15 of them to just barely imitate the functionality of modern search engines, there is another option: replace WordPress search with Google custom search. In this tutorial, we will to show you how to add Google Custom Search in WordPress.
Go to Appearance » Editor in your WordPress admin area and click on searchform.php file to open it in the editor. Paste the custom search engine code in the file. It is alright if this file does not contain anything else and just the Google custom search engine code.
If your theme does not have a searchform.php file, then you need to create one using a text editor like Notepad and upload it to your theme directory using FTP client.
After pasting Google custom search code, go to Appearance » Widgets to drag and drop the search widget into your sidebar.