Discourse’s search functionality is quite powerful and offers multiple filters, options, and advanced techniques to help you refine search results on any discussion forum. Here’s an overview of how it works:
Search Filters
Content Filters:
in:personal-direct: Filters posts in personal messages between two users.
in:all: Filters posts from both public topics and personal messages.
in:tagged / in:untagged: Filters posts from topics with or without tags.
Date Filters:
before:YYYY-MM-DD / after:YYYY-MM-DD: Filters posts created before or after a specific date.
Post and View Count Filters:
min_posts:X: Filters topics with at least ‘X’ number of posts.
min_views:X: Filters topics with at least ‘X’ number of views.
User-Specific Filters:
@username / user:username: Filters posts made by a specific user.
personal_messages:username: Admin-only filter to view all personal messages of a user.
Category and Tag Filters:
category:category1,category2: Returns posts from specified categories.
tags:tag1,tag2: Returns posts from topics tagged with specific tags.
Status Filters:
status:open / status:closed: Filters posts from topics that are open or closed.
Search Syntax
Exact Words: Use double quotes with spaces, e.g., " word ", to search for exact terms.
Combining Filters: You can combine multiple filters in one search query, like status:open category:support after:2023-01-01.
Sorting Options
Results can be sorted by various criteria such as:
order:latest: Newest to oldest.
order:likes: Sorted by the number of likes.
Plugin-Specific Filters
Discourse allows plugins to add additional filters, for example:
In Discourse, the handling of search terms is quite sophisticated, leveraging various techniques to enhance search capabilities. Here’s an overview of how search terms are used and processed:
Search Term Processing
Stemming:
Discourse employs a technique known as Stemming, which involves reducing words to their root form. This is useful for finding related words within the search (e.g., searching for “run” will also return “running” or “runs”).
Exact Word Search:
If you need to search for an exact term without stemming, you can enclose the word in spaces and double quotes. For example, using " term " ensures the search only returns results for the term without related variations.
Search Syntax and Filters:
You can use various syntaxes to refine your search, including filters for specific user messages, tags, categories, dates, and more.
Example of combining filters:
@username in:watching after:2023-01-01 will search for posts by a user in watched topics created after January 1st, 2023.
Custom Search Filters:
Discourse allows for complex search queries by combining different criteria, such as user-generated content (@username), topic status (status:open), or content types (in:wiki, with:images).
Search Order:
Results can be sorted by attributes like the latest post, number of views, or likes, using order syntax such as order:latest to sort them from newest to oldest.
Search Alternatives:
An experimental filter feature allows users to refine topics lists directly, catering for various filter types as described in the documentation.
For a more detailed guide, check out the tips on Searching for content effectively on Discourse Meta. This resource explains these concepts and provides examples of how to apply advanced search techniques.