There are two substantial open issues in the field of the image retrieval: semantic gap between computationally extracted low-level features and human operated high-level concepts, and high retrieval speed independent from the volume of the database. Search of the images on the level of objects or regions (segmentation) is a step towards semanticbased retrieval. In this paper we propose a new clusterlike indexing algorithm in metric space which preliminary transforms distance matrix into blockdiagonal form and ensures the minimum number of matches at the retrieval stage. This form can be used separately or embedded into existent indexing methods.