What distinguishes legal analogy from superficial resemblance?

Authority of Qiyas and Five Conditions for Sound Analogy