Copied from original, and made it work (barely).

Admin and parsing are probably broken.
Rewritten SearchServlet in Java and migrated app to HRD.