code for PartialIndex