Small code cleanup, moving files from app to lib, shared search routine and handler

Mostly to fix a dependency issue I was getting when trying to test openstax_api.
Can we really get rid of this?  I think other repos depend on this (at least they did when this line was added).