optimize IndexDoc and UnindexDoc