Query adaptive image search using hash codes