Search - partial implementation.

Search still doesn't work like it should. I'm committing this so I can
sync the branch and get access to the recent changes in the php code.