200 2.4 KB

12345678910111213141516171819202122232425262728293031
  1. ---
  2. title: Autocomplete: two suggestions for the same account
  3. author: notabug.org/aab
  4. time: Sun, 09 Aug 2020 09:28:38 UTC
  5. status: open
  6. ---
  7. author: notabug.org
  8. time: Sun, 09 Aug 2020 09:28:38 UTC
  9. content: -----
  10. I guess it is not because of autocomplete, but i don't really know the origin of this; maybe the fix_duplicates script not removing duplicates of the same server where it is executed? It works fine for remote accounts (EDIT: no, it doesn't, read below).
  11. -----
  12. author: notabug.org
  13. time: Tue, 11 Aug 2020 15:44:42 UTC
  14. content: -----
  15. I've prepared a query that returns all remote profiles that have duplicates. PostgreSQL: ```sql SELECT ("profile"."nickname" || '@' || regexp_replace("profile"."profileurl", '^https?://([^/]+)/.*$', '\1')) COLLATE "C" AS "remote_profile", MAX("profile"."created") AS "most_recent", COUNT(*) AS "count" FROM "profile" LEFT JOIN "user" ON "profile"."id" = "user"."id" LEFT JOIN "user_group" ON "profile"."id" = "user_group"."profile_id" WHERE "profile"."nickname" <> '' AND "user"."id" IS NULL AND "user_group"."profile_id" IS NULL GROUP BY "remote_profile" HAVING COUNT(*) > 1 ORDER BY "count" DESC; ``` MariaDB: ```sql SELECT concat(`profile`.`nickname`, '@', regexp_substr(`profile`.`profileurl`, '(?:(?<=http://)|(?<=https://))([^/]+)')) AS `remote_profile`, MAX(`profile`.`created`) AS `most_recent`, COUNT(*) AS `count` FROM `profile` LEFT JOIN `user` ON `profile`.`id` = `user`.`id` LEFT JOIN `user_group` ON `profile`.`id` = `user_group`.`profile_id` WHERE `profile`.`nickname` <> '' AND `user`.`id` IS NULL AND `user_group`.`profile_id` IS NULL GROUP BY `remote_profile` HAVING COUNT(*) > 1 ORDER BY `count` DESC; ```
  16. -----
  17. author: notabug.org
  18. time: Fri, 14 Aug 2020 22:05:59 UTC
  19. content: -----
  20. Using that query (thanks!) i've seen that executing some of OStatus scripts and fix_duplicates.php again improves the situation (from 73 to 29 repeated profiles) and the count (from 14 to 3). Anyway, it seems that if the remote node is down (or dead), there's no way to de-duplicate profiles: FWIW: Unable to connect to tls://social.ingobernable.net:443. Error: Conexi?n rehusada
  21. -----
  22. author: notabug.org
  23. time: Sun, 16 Aug 2020 17:56:22 UTC
  24. content: -----
  25. Ok, deleting from "profile" the ones already dead, and with some more cleaning, fix_duplicates.php returns nothing :) I'm only seeing this now with local profiles, which kind of makes sense... or not? :)
  26. -----