This is the the resulting code of a 5 part series which you can read here http://www.boyter.org/2013/01/code-for-a-search-engine-in-php-part-1/
For help setting it up see the following link http://www.boyter.org/2014/04/installing-phindex/ which walks through getting setup with 10,000 documents from scatch.
Keep in mind this was never intended to be a drop in replacement for any existing search service or even a install and index solution. You will need to modify code to do anything with this. This may change in the future as I have some additional code which should allow the creation of a full search solution.