1. The document introduces an approach to enable query-adaptive ranking of images returned from image search based on hash codes. 2. It achieves this by first learning offline bitwise weights of hash codes for predefined semantic concept classes, and formulating the weight learning as a quadratic program to minimize intra-class distance while preserving inter-class relationships captured in raw image features. 3. Query-adaptive weights are then computed online by evaluating the proximity between a query and semantic concept classes. With these weights, returned images can be ordered by weighted Hamming distance at a finer-grained level than the original Hamming distance.