Design and analysis of algorithms for similarity search based on intrinsic dimension