add better exception handling.

change public to protected in BaseSearch class.