데이터베이스 손상 때문에 태그가 중복되어 있고 병합이 안 됩니다

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.

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)

@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.

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)

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) - #14 by pfaffman. 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:

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.

저도 이것이 #contribute:bug라고 생각합니다. 더 나쁜 점은 이것이 계속되고 있다는 것입니다! 이전 중복 항목을 삭제해도 계속해서 새로운 중복 항목이 생깁니다. 도움이 된다면 비공식 플러그인을 제거하고 새로운 중복 항목이 생성되는지 확인해 볼 수 있습니다.

파르시어(페르시아어) 때문이라면, 서로 다른 키보드가 사용하는 겉보기에는 비슷하지만 기본적으로 다른 문자 때문일 수 있습니다. 예를 들어 일부 기기는 아랍 문자를, 일부는 페르시아 문자를 사용합니다. 이러한 키보드에는 يی가 있으며, 단어 안에서 이 둘을 구별할 수 없지만(인코딩에서는 다릅니다) 서로 다른 문자입니다.

하지만 @Pfaffman님의 경우는 영어 인덱스에 대한 것이었고, 페르시아어가 아니었습니다!

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