This paper presents a novel approach for query-adaptive image search using hash codes to improve ranking for images with equal Hamming distances. It introduces a method for learning bitwise weights that enhances the differentiation of images in terms of similarity to the query, thus providing finer-grained ranking. Experiments indicate significant improvements in search performance on a Flickr image dataset over traditional methods.