Restricted visibility of some internal functions and variables

Added basic tests for search_metadata