Discourse’s search capability is feature-rich. It comes with many of filters and criteria. When you use these from the advanced search form, it automatically appends the relevant syntax to your query.
For instance, if you select In my messages, it will append in:personal
to your search query.
This topic aims to list other filters that aren’t available in the advanced search form, filter aliases, results orders and other search-related tips and tricks.
It will not cover filters available from the advanced search form.
Filters
Syntax | Description |
---|---|
in:personal-direct |
Returns posts in personal messages between two users only |
in:all-pms |
![]() Returns posts from all personal messages, including those you’re not a part of |
in:all |
Returns posts from public topics and personal messages |
in:tagged |
Returns posts from topics that have at least one tag |
in:untagged |
Returns posts from topics with no tags |
posts_count:X |
Returns posts from topics that have exactly X posts |
badge:name_or_id |
![]() Aimed to return posts linked to a specific badge grant |
created:@username |
Returns posts from topics created by username |
group:group_name |
Returns posts from users within the group_name group |
group_messages:group_name |
Returns posts from personal messages sent to the group_name group |
-tags:tag1,tag2,tag3 |
Returns posts not tagged with tag1 , tag2 , or tag3 |
filetypes:ext1,ext2,ext3 |
Returns posts with uploads of ext1 , ext2 , or ext3 file extensions |
Order
Syntax | Description |
---|---|
order:oldest |
Sorts results from oldest to newest |
order:oldest_topic |
Sorts results by topic date, from oldest to newest |
Aliases
Syntax | Equivalent |
---|---|
l |
order:latest |
in:personal |
in:messages |
min_post_count: |
min_post: |
in:mine |
in:created |
category: |
# |
tag: |
# |
user: |
@ |
@me |
@your_own_username |
Search for Exact Words
Discourse’s search uses a technique called Stemming. It allows the search engine to find related words.
For example, a search for “improv” returns:
- improve
- improving
- improvements
- improved
- improver
And so on.
While this is often beneficial, there might be occasions when you want to search for the exact word. This can be achieved by enclosing your word with spaces and double quotes, like so:
" improve "
This ensures that it will search only for the word “improve” and exclude other related words.
For instance:
Note that because of the spaces considered as mandatory since they’re wrapped with double quotes, it will not return “improve” if it’s the first or the last word of a post since it won’t be preceded or followed by a space.
Example: Search for @mentions
Currently, searching for @mentions is not supported. However, using the above method, you can achieve it like so:
https://meta.discourse.org/search?q="%20%40canapin%20"
This query will look specifically for @canapin
(enclosed in spaces).
Search Alternative: Topic List Filter
An experimental /filter feature is available that supports many filter types. You can learn more on the official topic:
Source Files
All search filters and parameters can be found in search.rb
. Look for the advanced_filter
methods.