Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up tags #1024

Open
rob-hills opened this issue Jul 18, 2021 · 3 comments
Open

Clean up tags #1024

rob-hills opened this issue Jul 18, 2021 · 3 comments

Comments

@rob-hills
Copy link
Contributor

User defined tags are a wonderful thing, but unfortunately they get messy after a while. Our tag dataset has accumulated annoying little problems like duplicates with different case or different/incorrect spelling, tags with punctuation marks appended etc.

Some of these problem tags can simply be edited away. However, misspelled (or alternate-case) tags can't just be edited without creating duplicates.

I would like to see two changes to Tendenci to improve tags:

  1. When a user tags an article, I assume Tendenci checks if that tag exists in the tagging_tags table and if it doesn't exist, add it. I believe that search for an existing tag should be case insensitive . This will prevent different-case duplicates from getting into the database; and
  2. Add a facility to Tendenci that enables two tags to be merged. This would involve deleting one tag from the tagging_tags table and updating all tagging_taggeditem records that have the deleted tag's id, replacing them with the merged tag's id (or possibly in the reverse order depending on foreign-key constraints).
@jennyq
Copy link
Member

jennyq commented Jul 20, 2021

Hi @rob-hills,

Tendenci uses django-tagging to manage the tags. The tag name is a unique field, but it does not check upper or lower cases for duplicates https://github.com/Fantomas42/django-tagging/blob/develop/tagging/models.py#L476. We probably can not change that. What we can do is to add the merge feature, as you described, to enable two or more tags to be merged.

@rob-hills
Copy link
Contributor Author

rob-hills commented Jul 22, 2021

Hi @jennyq,

Thanks for your reply. Interestingly, in the tagging models code you linked, line 70 checks for a setting named settings.FORCE_LOWER_CASE. I did some sleuthing and found the documentation about the FORCE_LOWERCASE_TAGS setting.

Of course forcing all tags to lower case isn't exactly the same as having a case-insensitive tag comparison, but it achieves the same goal, reducing tagging mess and confusion caused by case-sensitive tags.

Obviously I'll need to sort out our tag data before switching this setting on. I can do this with some one-off SQL, though the proposed tag merge functionality would be very helpful here. However, I don't imagine this would be a high priority enhancement?

@jennyq
Copy link
Member

jennyq commented Jul 23, 2021

@rob-hills, Good found on the doc about the setting FORCE_LOWERCASE_TAGS. For the tag merge functionality, we'll consider it after the next major version release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants