Using SOLR to calculate “similarity”/“bitcount” between two ulongs
We have a database of images where I have calculated the PHASH using Dr. Neal Krawetz's method as implemented by David Oftedal . Part of the sample code calculates the difference between these longs is here: ulong hash1 = AverageHash(theImage); ulong hash2 = AverageHash(theOtherImage); uint BitCount(ulong theNumber) { uint count = 0; for (; theNumber > 0; theNumber >>= 8) { count += bitCounts[(theNumber & 0xFF)]; } return count; } Console.WriteLine("Similarity: " + ((64 - BitCount(hash1 ^ hash2)) * 100.0) / 64.0 + "%"); The challenge is that I only know one of these hashes and I want to query