Function for simple database search