How to do a category: search for multi-word categories?

search

(Michael Downey) #1

So I have some categories that have one-word titles, e.g., “Foo”, and also categories that have more than one word, e.g., “Foo Bar”.

The following works for constraining search results to a category:
category:Foo or https://discourse.example.org/search?q=category%3AFoo

The following does not work:
category:Foo Bar or https://discourse.example.org/search?q=category%3AFoo%20Bar

Meta repro:
category:discourse hub or Search results for 'category:discourse hub' - Discourse Meta


I was doing this because I wanted to put a hyperlink to such a query to show the unsolved topics in my support category, but can’t because that category has multiple words. :slight_smile:


(Hannah Fordham) #2

You need to use underscores:
category:discourse_hub or https://meta.discourse.org/search?q=category%3Adiscourse_hub

I don’t know why it doesn’t use the hyphens that the categories use in URL view, but I tried underscores because that’s what some other things use in Discourse and it worked. :slight_smile: