There are some duplicated tags due to database corruption and I can't merge

as can be seen in the image, in our forums there are some tags that are exactly the same!

when creating a topic, you will see different number of topics in these tags:

but if you choose one, both will be chosen. but then as you click on the tags, both direct you to the same page with similar topics and topic numbers. so admins can’t merge them or delete one of them.

this is a sample topic in our forum with 2 sets of duplicated tags.

1 Like

I had a similar problem that was due to an index being corrupt.

I don’t know if this will help Can't restore due to corrupt indexes (with some clues on how to deal with corrupt indexes)

6 Likes

@neil any ideas here, is this a side effect of synonyms?

Unlikely, we’ve seen a lot of corrupt indexes and bad third party plugins cause this.

Sounds the same as this topic:

There’s a unique index on the tag name column, so it shouldn’t be possible to have duplicate tags. I’m guessing if you did reindex table tags it would fail.

@pfaffman’s process here is probably what you’ll need to do to remove the duplicate tags and fix the indexes.

2 Likes

this is the list of plugins we have, I guess none of them may be related to tags:

I already removed them by hand! or let’s say, I could remove one of the duplicates for each pair; and then the page for the other tag in the pair became in-accessible (even for admins)! as we go to the page, we get “that page doesn’t exist or is private”, though there are several topics with that tag.

an example would be tag یادگیری which should have 488 topics in it, while the tag-page doesn’t exist (link to the tag page):

image

p.s.: sorry the pages and the tags are non-English. I hope it gives a clue.

It sounds like you did it from the UI, but it can’t be done that way. As Jay did, you need to update all topics that use one of the tags to use the other, like in his example:

TopicTag.where(tag_id: 717).update_all(tag_id: 611)
4 Likes

thanks, are there any command to find the corrupted tags (those I have already changed from UI) as well as the duplicated tags? if so, may you guide me?

I describe how I did it (or something similar) over at Can't restore due to corrupt indexes (with some clues on how to deal with corrupt indexes). It’s far from a howto, but might help. You have to switch back and forth between the rails console and psql, which if you’re not familiar with both might be confusing or intimidating. If it doesn’t and you have a budget, I’ve done it recently. :wink:

2 Likes

I don’t think the index corruption is caused by a plugin.
I’ve seen this kind of PSQL index corruption five times in the past few months and four of them were using Farsi language settings.

4 Likes

I also think this is a #bug, and the bad part is that it’s ongoing! no matter I have deleted previous duplicates, I get new ones again. if it helps I can remove the non-official plugins and check the birth of new duplicates.

if it was due to Farsi language, I’d suggest it may be because of some of apparently similar but basically different alphabets that different keyboards are using. for example some devices use Arabic alphabet and some use Persian. and in these keyboards we have ي and ی, which when used in a word one can’t distinguish among them (but they are different in encoding).

but @Pfaffman 's case was for English indexes, bot Persian!

1 Like

Yes, that is the (sole) not-Farsi one I know of.

1 Like