Search for/merge duplicate topics

AI-generated summary

In a discussion titled “Search for/merge duplicate topics” under the Migration category, danb35 describes issues following a Yahoo Groups import into Discourse, where many discussions were fragmented into multiple topics with identical titles—sometimes over a dozen—due to misalignment in reply threading, Yahoo’s structure, or import script limitations. danb35 raises three key questions: (1) Is there an automated way to detect such duplicates, especially since the imported 20k+ topics ignored the site’s no-duplicate-topic setting? (2) Can these fragmented topics be merged into one while preserving message chronology? danb35 notes that manually moving posts via the UI is tedious and disrupts chronological order. (3) Can this merging be done without bumping the topic—since moving posts into a 15-year-old thread triggered unwanted emails to users in mailing list mode, causing confusion. danb35 acknowledges that archives could be left as-is but prefers restoring discussion integrity for usability. pfaffman suggests searching by title to find duplicates and mentions that a Rails console script could merge them, though no ready examples exist. pfaffman also advises exploring the Marketplace if budget allows and no solutions emerge here.

My import from Yahoo groups has resulted in many topics being fragmented (whether because the users weren’t replying properly in the past, because Yahoo didn’t keep the topic together properly, or because the import script didn’t correctly recognize what Yahoo had done–or some combination of these)–in one case I ran across, this resulted in over a dozen Discourse topics, all with the same title, that were all in fact part of the same discussion. This leads to two questions:

  • Is there an automatic way of finding these duplicates? My site isn’t set to allow duplicate topics, but the 20k+ topics I imported didn’t respect this setting.
  • Having found them, is there a way to merge them into a single topic, preserving the chronology of the messages? I know I can individually move messages to another topic, and that kind of does the job, except that it doesn’t keep the chronology very well, and it’s kind of tedious (wrench, select posts, select all, move to, existing topic, enter number, move, back, wrench, unlist topic, lather, rinse, repeat).
  • (OK, three questions) can the above be done without bumping the topic? One topic I manually cleaned up was 15 years old, and every time I moved posts into it, it sent out emails to my users who had mailing list mode enabled (which is most of them), resulting a little confusion.

There’s a part of me that feels like archives are archives and I can just let them be–but I’d prefer they be a bit more useful, which would mean that discussions have a bit more integrity than they have right now.

You could do a search sorted by title to find the dupes. You could run a rails console script to merge them, though I don’t know that any examples exist.

If you have a budget and no one offers a solution here you could ask in Marketplace.