The easiest way would be to write a plugin, the details are on Joomla Doc's in the Developer Portal. There's even a Plugin Portal with all relevant articles listed.
Joomla has two types of search plugin, the older standard /plugins/search/
and the relatively (since 2.5) Smart Search, which has it's plugins in /plugins/finder
.
Standard search plugins are relatively easy to write and are described in the Creating a Search Plug (note this is a landing page from which you select the version of Joomla you're writing for).
Smart Search was introduced with the 2.5 line and the Creating a Smart Search plug-in article covers them..