Converting categories to tags


(Tadej Novak) #1

I recently converted phpbb forum to discourse. Now I have some cleanup to do. Mainly I have two things to do:

  • I want to convert some categories in tags
  • some categories may need to be merged in the process

Is there a simple way to do this? At least select all topics in a category would help a lot (I couldn’t find a button). Then I can use bulk tools to edit topics.


(Jeff Atwood) #2

I don’t think there is any support for bulk conversion from categories to tags, however, you should be able to

  • bulk switch category to “uncategorized”
  • bulk tag

Isn’t that so @eviltrout?


(Lisa Wess) #3

I was also very much seeking out a 'select all. Our use case is on the full search page. I expected a select box that would hit all of the topics but alas, there is not one…

We’ll definitely need this for categories in the coming months as well.

The bulk actions are there; not the bulk select.


(Jeff Atwood) #5

Select all would only affect visible topics, as in what is visible on your screen right now, though.


(Mittineague) #6

Yes, it sounds like a carefully crafted database query would be the way to go.


(Lisa Wess) #7

That would be a fairly big improvement, at least for us. Though it does lead to a potential need for pagination in some cases (in place of lazy loading)


(Jeff Atwood) #8

Selecting everything on the screen is no problem. It’s when you have a search result of 10,000 items or 1,000 items that it becomes problematic…


(cpradio) #9

Couldn’t you just refresh the page, ideally you’d be on a filter that would exclude the ones you are altering, so when you refresh, that first view of items will not be listed anymore.


(Lisa Wess) #10

That would work in some cases like re-categorizing; but not for adding tags unless the filter was really smart, I guess?


(Tadej Novak) #11

As my categories do not contain many topics (that’s why I want to convert them to tags in discourse) I will probably use jQuery to select all and then bulk tag and move to another category. Currently I don’t have time to learn the internals and come up with a database/api query.


(Sam Saffron) #12

You already have that today though :smile:

https://meta.discourse.org/search?q=category%3Abug%20order%3Alatest


(Erlend Sogge Heggen) #13

Could the rails console be used to accomplish this? Something along these lines perhaps:


Bulk move many topics from one category to another
(Tobias Eigen) #14

That did work very well just now for moving all topics out of one category and into another - thanks for pointing it out!

I have the need to add tags to all topics first before moving them. @riking could you suggest rails commands for this? I’d be grateful.


(Chris Croome) #15

I appear to have worked out how to do this and posted a solution that seems to work here: