How to create 1000 subcategories in a scalable way?


(Volkan Unsal) #1

I’d like to create a lot of subcategories for a handful of top level categories. But I have a problem: Discourse preloads all the subcategories in the body of the page as JSON objects and this is seriously affecting the page load time. It’s not scalable.

I’m planning to implement an autocomplete-like widget to replace the subcategory dropdown. I just wanted to reach out to a) ask if anyone knew of something like this already and b) tips on where to get started for a feature like this.


(Jeff Atwood) #2

Sounds like you want the tagging plugin, not actual subcategories.


(Volkan Unsal) #3

Well, I’d also like the users to monitor the discussions from the categories and have some security permissions around the posts, too. The tagging plugin won’t let me do those. The alternative is to just create my own category plugin that replicates all the functionality of categories, which is going to be the last resort.


(Sam Saffron) #4

I am still not following, can you make this a bit more concrete explaining what it is you are doing that requires this immense level of categorization ?


#5

If you want 2000 subs it sounds like you want stock ticker symbols, am I right (because that would be around the right count)?

Let me know because I have additional things you need to consider. If not disregard.


(Volkan Unsal) #6

I am creating a discussion board for schools. Each school is a category within the larger system of schools. The notion of category fits really well in this use case. If only the categories weren’t pre-loaded in the page, I could just fly with it.


(cpradio) #7

Actually, I think multi-site would fit better here. Each school would be a site with their own categories.


(Volkan Unsal) #8

Doesn’t multisite require multiple logins? I assumed you’d need multiple user accounts across different sites with that approach.


(cpradio) #9

I’d have to run a test, but I think they all refer to the same database, they just separate the categories, topics, posts by site. I’ll see what documentation I can find.


(cpradio) #10

So here is how to configure it

Then there is this topic
https://meta.discourse.org/t/can-multisite-instances-communicate-with-one-another/8984?source_topic_id=18158

But it doesn’t quite answer if signing up pushes your user to all sites defined in the multisite.yaml… @neil, can you answer that?


(Volkan Unsal) #11

Thanks! I’m still trying to figure this out, but multisite might be good for my use case. I think you could use postgres schemas to mitigate some of the resource overhead. And you also would need to make some tables shared by all schemas, though. So maybe I should try to hack the multisite plugin rather than creating a new category plugin.