This is ruby. This example assumes you are on something like a unix/linux system (or the part that sees if the files are text based or not will fail)
To run the example:
Save the three files to a directory
Install ruby on the command line type:
gem install bundler
bundle
run
ruby indexer.rb
to index all the files in the current directory and in its subdirectories that are text based
run
ruby index.rb
to get a nice web page with a search form (visit http://localhost:4567 to see the result)
updated example to ignore nil query string and even added a nice submit button. Less minimal now...