Search functionality to work with pg