Search database with list of ids