I wish to produce a search function which returns matching parts of information from files like .pdf and .doc. These files would be on the website, the site visitors will just choose the files to look and enter key phrases. Results need to look like Search results.

I wish to embed this function onto a Wordpress site.

How do i accomplish this?