Last active
September 29, 2015 15:57
-
-
Save tylerpearson/a8afde8f4e72db0f5e80 to your computer and use it in GitHub Desktop.
sample SQL query to find related posts using a simhash
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT id, title, (LENGTH(CONV(fp ^ ?, 10, 2)) - LENGTH(REPLACE(CONV(fp ^ ?, 10, 2), '1', ''))) / LENGTH('1') AS comparison | |
FROM posts | |
ORDER BY comparison ASC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment