If you only need the IDs here, you should be using WikiFactory::getVarIdByName()