Build indices for tags