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)
Yup this basically works, it just doesn't like the query string to be empty.. so http://localhost:4567?q=index (for example) will work, hey this is just an example ...