Ask Your Question
3

Is there a way to purge unused tags from the DB?

asked 2010-11-19 10:30:45 -0600

Benoit gravatar image

updated 2010-11-21 21:33:37 -0600

Evgeny gravatar image

If I miss-tagged a question with "perview" instead of "preview". I go back and fix the tag.

However, I now have a tag "perview" in the system.
Is there a way to purge those unused tags? It would be ok if I had to explicitly do it.

something like: "python manage.py purge_tag perview"

If the in tag was used, I should get an error:

 "Error: Tag 'perview' is in use (in 2 questions: [148, 172])"

Showing the # of questions and the question number would be a nice bonus.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2010-11-19 16:48:46 -0600

Evgeny gravatar image

updated 2010-11-21 21:31:53 -0600

added management commands:

  • delete_unused_tags (no arguments)
  • rename_tags (arguments: --from, --to, [--user-id])
  • rename_tags_id (same arguments as in rename_tags, but renames by tag id's)

Both --from and --to parameters can have multiple tags, so you can split, rename and merge tags. If a parameter has multiple tags, it must be quoted.

Example:

python manage.py rename_tags --from biochemistry --to 'biology chemistry'

To find out more, type python manage.py <command> --help.

Give it a try. I had some dilemma on whether to mark retagging activity as the latest activity on the question or not. Right now the effective user will be marked as having performed the operation.

Please note that with MySQL in askbot transactions don't work, so it will be a good idea to make a backup, at least till you become comfortable with the commands.

edit flag offensive delete link more

Comments

Is there a UI to access these commands on an askbot.com hosted site?

todofixthis gravatar imagetodofixthis ( 2012-07-28 11:13:55 -0600 )edit
1

Not yet, we should get this done as for the hosted site this would be the only option.

Evgeny gravatar imageEvgeny ( 2012-07-28 11:48:39 -0600 )edit

Can these commands be run when askbot is running, or does one need to shut it down before running these?

FranciscoD gravatar imageFranciscoD ( 2013-06-10 07:27:49 -0600 )edit
1

@FranciscoD it's safe to run them on the active site.

Evgeny gravatar imageEvgeny ( 2013-06-10 10:39:43 -0600 )edit

Great. Thanks :)

FranciscoD gravatar imageFranciscoD ( 2013-06-11 22:37:21 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2010-11-19 10:30:45 -0600

Seen: 188 times

Last updated: Nov 21 '10