A Search Function for your Website
This was an old page that I speculated on whether I should try to implement a search facility of my own. I subsequently decided to concentrate my efforts on SEO.
The site search that seems to be a default with most Wordpress themes works quite well.
Having a database would help here
This is why you see this pretty much as standard on Wordpress themes. All data and "control information" on Wordpress is stored in a MySQL database. As such you can search this database for any pages or the content on those pages. The database will automatically be indexed and tables linked to enable the Wordpress website to operate.