Should search limited to category also search subcategories?

AI-generated summary

There’s a discussion about whether searching a category should also include subcategories by default. pfaffman initially thought it did, but discovered it didn’t. erlend_sh agreed that searching category and subcategories by default makes sense, but noted that a syntax is needed to search only the parent category.

erlend_sh mentioned that this is now supported through a change by sam, allowing users to search a category and its subcategories using something #howto or something category:howto, and to restrict the search to the parent category using something #=howto or something category:=howto.

The discussion then shifted to what to do with the “search this category” checkbox. pfaffman suggested having two checkboxes, but codinghorror disagreed, stating that two checkboxes are rarely the right choice. pfaffman then voted for the checkbox to include subcategories by default. cpradio pointed out that including subcategories is already the default behavior, and sam agreed that including by default is probably a better call, suggesting that the wording of “Search the howto category” may need to be improved.

I have a category for challenges/assignments that is empty except for its subcategories. I thought that I could search that category and find things in subcategories, but I can’t.

Here on meta, click on Customization > Plugin and search for “discord” you can find “Discourse to Discord bot” post, but if you search the plugin category, it goes away. It’d be cool if I could search across all those categories.

7 Likes

Hmm yeh, haven’t really encountered this before but I think searching category+sub-categories by default makes sense. We’d have to come up with some sort of syntax for when you only want to search the parent category though, like category:plugin+none

2 Likes

This is now supported as per this change by @sam

https://github.com/discourse/discourse/commit/df8f365d999e113615c51efee4cfa3115c267783

So:

To search howto and all sub categories use

something howto

OR

something category:howto

To restrict it so you only search the category howto without children use:

something #=howto

OR

something category:=howto


We still need to decide what to do about the “search this category” checkbox.

6 Likes

Is there room for two check boxes?

When is two checkboxes ever the right choice?

5 Likes

Sounds compelling. In that case, I vote for the check box to include subcategories.

1 Like

You mean to exclude? As it is included by default now…

1 Like

I think he means this :slight_smile:

I also think include by default is probably a better call

“Search the howto category” may need slightly better wording though.

7 Likes