The fine folks at Princeton have an online database of synonyms that can also be used with your own code. This is pretty amazing, given how carefully guarded most of the traditional thesaurus providers have been.
See the main site, the very generous license (free for commercial use and modification under reasonable conditions), doc, stats and download.
Of course for a search application you'll need to actually do something with it. There is a WordNet analyzer listed in the Lucene sandbox, though the link is broken. But we have it on good authority that it does work...
Here's an article on stemming and lemmatization that includes info on thesaurus based searching, among other things.

shows simply how to remove a word using the replace method (based on our favorite, regex), while his second post has a great little function for searching for text that uses a recursive search for nodes that contain a pattern. It includes a cool demo of its capabilities as a link right under the code listing.