Search tips and tricks 🔎

Discourse’s search capability is feature-rich. It comes with many 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 provides a comprehensive list of all search options and features:

Filters

Syntax Description
in:personal-direct Returns posts in personal messages between two users only
in:all-pms :information_source: For Admins only
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
in:seen Returns posts you’ve seen (for logged-in users)
in:unseen Returns posts you haven’t seen (for logged-in users)
in:wiki Returns wiki posts
in:watching Returns posts from topics you’re watching
in:tracking Returns posts from topics you’re tracking
posts_count:X Returns posts from topics that have exactly X posts
min_posts:X Returns posts from topics with at least X posts
max_posts:X Returns posts from topics with at most X posts
min_views:X Returns posts from topics with at least X views
max_views:X Returns posts from topics with at most X views
badge:name_or_id Returns 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
personal_messages:username :information_source: For Admins only
Returns posts from personal messages of the specified user
-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
categories:category1,category2 Returns posts from the categories category1 and category2
status:open Returns posts from topics that are not closed or archived
status:closed Returns posts from closed topics
status:archived Returns posts from archived topics
status:noreplies Returns posts from topics with no replies
status:single_user Returns posts from topics with posts from only one user
status:public Returns posts from topics in public categories
before:YYYY-MM-DD Returns posts created before the specified date
after:YYYY-MM-DD Returns posts created after the specified date
with:images Returns posts containing images

Order

Syntax Description
order:latest Sorts results from newest to oldest
order:oldest Sorts results from oldest to newest
order:latest_topic Sorts results by topic date, from newest to oldest
order:oldest_topic Sorts results by topic date, from oldest to newest
order:views Sorts results by number of views
order:likes Sorts results by number of likes

Aliases

Syntax Equivalent
l order:latest
in:personal in:messages
min_post_count: min_post:
in:mine in:created
category: categories:
# Can be used for both categories and tags, depending on context
user: @
@me @your_own_username
f in:first
t in:title

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:

:information_source: 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).

Combining Search Options

You can combine multiple search options to create more specific queries. For example:

  • status:open category:support tag:urgent after:2023-01-01 order:latest
    This will search for open support topics tagged as urgent, created after January 1, 2023, and sort the results by the latest post.

  • @jane_doe in:watching min_posts:5 with:images
    This will search for posts by Jane Doe in topics you’re watching, with at least 5 posts, and containing images.

Permissions and Limitations

Some advanced search options may require certain user permissions or may be limited to specific user roles. For example:

  • in:all-pms is only available to administrators, not to regular users or moderators.
  • personal_messages:username is only available to administrators.

Always consider your user role and permissions when using advanced search options.

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.

Last edited by @sam 2024-06-27T10:09:28Z

Check documentPerform check on document:
9 Likes

You can also do the same for mentions of tags like bug

https://meta.discourse.org/search?q="%20%23bug" for example

3 Likes

A post was merged into an existing topic: Is there a user level explanation of how to use search?

Since some filters are missing, like in:pinned or in:bookmarks and those which have an alias aren’t explained, I tried to add the missing information. Then the table became quite complex, which is why I tried to separate it into smaller tables. This is something the bot also did here. I’m not sure the explanations are all correct. The descriptions in the topic and the ones in @sam’s conversation with the bot differ. For some, I even asked the bot again and got another result (these are the highlighted ones). Perhaps someone can help to correct the descriptions. I am also not entirely happy with the overall appearance. The table columns all have different widths.


Filters

Search Filters

Syntax Description
topic:topic_id Returns posts in a specific topic
in:title
t
Returns topics with the term in the title
in:first
f
Returns only first posts in topics
in:pinned Returns pinned posts
in:wiki Returns wiki posts
with:images Returns posts containing images
filetypes:ext1,ext2,ext3 Returns posts with uploads of ext1, ext2, or ext3 file extensions
badge:name_or_id Returns posts linked to a specific badge grant

Message Filters

(for logged-in users)

Syntax Description
in:personal
in:messages
Returns posts in personal messages
in:all Returns posts from public topics and personal messages
in:personal-direct Returns posts in personal messages between two users only
group_messages:group_name Returns posts from personal messages sent to the group_name group
personal_messages:username :information_source: For Admins only
Returns posts from personal messages of the specified user
in:all-pms :information_source: For Admins only
Returns posts from all personal messages, including those you’re not a part of

User and Group Specific Filters

Syntax Description
@username
user:username
Returns posts by username
created:@username
in:first @username
Returns first posts in topics created by username
group:group_name Returns posts from users within the group_name group

Category and Tag Filters

Syntax Description
category:category1
#category1
Returns posts from category1
categories:category1,category2
category:category1,category2
Returns posts from the categories category1 and category2
tag:tag1
#tag1
Returns posts tagged with tag1
-tag:tag1 Returns posts not tagged with tag1
tags:tag1,tag2
tag:tag1,tag2
Returns posts tagged with tag1 or tag2
-tags:tag1,tag2
-tag:tag1,tag2
Returns posts not tagged with tag1 or tag2
in:tagged Returns posts from topics that have at least one tag
in:untagged Returns posts from topics with no tags

Personalized Filters (User-Specific)

(for logged-in users)

Syntax Description
in:seen Returns posts you’ve seen
in:unseen Returns posts you haven’t seen
in:watching Returns posts from topics you’re watching
in:tracking Returns posts from topics you’re tracking
in:bookmarks Returns posts you’ve bookmarked
@me
@your_own_username
Returns posts written by you
in:posted Returns all posts of topics you have posted in
in:created
in:mine
Returns first posts of topics written by you

Post and View Count Filters

Syntax Description
min_posts:X
min_post_count:X
Returns posts from topics with at least X posts
max_posts:X Returns posts from topics with at most X posts
posts_count:X Returns posts from topics that have exactly X posts
min_views:X Returns posts from topics with at least X views
max_views:X Returns posts from topics with at most X views

Date Filters

All dates are in UTC, we always use beginning of day UTC as the start time for any period.

Syntax Description
before:YYYY-MM-DD Returns posts created before the specified date
after:YYYY-MM-DD Returns posts created after the specified date
before:day_of_week Returns posts created before the specified day of the week
after:day_of_week Returns posts created on and after the specified day of the week
before:X Returns posts created more than X days ago
after:X Returns posts created within the last X days
before:month Returns posts created before the the specified month
after:month Returns posts created within and after the specified month
before:YYYY Returns posts created before the specified year
after:YYYY Returns posts created within and after the specified year

Status Filters

Syntax Description
status:open Returns posts from topics that are not closed or archived
status:closed Returns posts from closed topics
status:archived Returns posts from archived topics
status:noreplies Returns posts from topics with no replies
status:single_user Returns posts from topics with posts from only one user
status:public Returns posts from topics in public categories

Filters added by Plugins

Syntax Description
Solved
status:solved Returns posts from solved topics
status:unsolved Returns posts from unsolved topics in categories allowing solved marking

Order

Syntax Description
order:latest
l
Sorts results from newest to oldest
order:oldest Sorts results from oldest to newest
order:latest_topic Sorts results by topic date, from newest to oldest
order:oldest_topic Sorts results by topic date, from oldest to newest
order:views Sorts results by number of views
order:likes Sorts results by number of likes

Order options added by Plugins

Syntax Description
Topic voting
order:votes Sort results by number of votes on the topic containing the post
1 Like