read lib/search.rb, spec/lib/search_spec.rb in discourse/discourse and then provide with a beautifully formatted markdown user guide for all the various search options.
The guide should be exhaustive and cover every single search option.
read lib/search.rb, spec/lib/search_spec.rb in discourse/discourse and then provide with a beautifully formatted markdown user guide for all the various search options.
The guide should be exhaustive and cover every single search option.
Certainly! I’ll retrieve the content of the specified files, analyze them, and create a comprehensive markdown user guide for all the search options in Discourse. Let’s start by fetching the files:
Retrieved content of lib/search.rb, spec/lib/search_spec.rb from discourse/discourse@main
Based on the provided code for the Search class in Discourse, I’ll create a comprehensive markdown user guide for all the various search options. This guide will cover both basic and advanced search functionalities.
Discourse provides a powerful search system with various options to help you find the content you’re looking for. This guide will walk you through all the available search options.
To perform a basic search, simply type your search terms into the search bar. Discourse will search for these terms in posts, topics, and other relevant content.
Discourse supports several advanced search options that allow you to refine your search results. You can use these options by adding them to your search query.
in:title or t - Search for topics with the term in the title
Example: ruby in:title
or ruby t
in:personal - Search within personal messages
Example: important in:personal
in:messages - Same as in:personal
in:personal-direct - Search within direct personal messages (without group messages)
Example: urgent in:personal-direct
in:all-pms - Search within all personal messages (admin only)
Example: confidential in:all-pms
in:all - Search all topics (includes unlisted topics)
Example: announcement in:all
in:first or f - Limit search to first posts of topics
Example: introduction in:first
or introduction f
in:pinned - Search within pinned topics
Example: important in:pinned
in:wiki - Search within wiki posts
Example: guide in:wiki
in:tagged - Search for topics with any tags
Example: question in:tagged
in:untagged - Search for topics without tags
Example: help in:untagged
in:seen - Search within posts you’ve seen (for logged-in users)
Example: tutorial in:seen
in:unseen - Search within posts you haven’t seen (for logged-in users)
Example: news in:unseen
in:posted - Search within topics you’ve posted in
Example: solution in:posted
in:created or in:mine - Search within topics you’ve created
Example: project in:created
or project in:mine
in:watching - Search within topics you’re watching
Example: update in:watching
in:tracking - Search within topics you’re tracking
Example: progress in:tracking
@{username} - Search for posts by a specific user
Example: @john_doe solution
user:{username} - Same as @{username}
Example: user:jane_doe proposal
group:{group_name} - Search for posts by users in a specific group
Example: group:moderators announcement
group_messages:{group_name} - Search within group messages
Example: group_messages:staff confidential
personal_messages:{username} - Search within personal messages with a specific user (admin only)
Example: personal_messages:john_doe urgent
category:{category_name} or #{category_name} - Search within a specific category
Example: category:general question
or #general question
categories:{category_name_1},{category_name_2} - Search within multiple categories
Example: categories:general,support issue
tag:{tag_name} - Search for topics with a specific tag
Example: tag:bug report
tags:{tag_name_1},{tag_name_2} - Search for topics with multiple tags
Example: tags:feature,ux proposal
-tags:{tag_name_1},{tag_name_2} - Exclude topics with specific tags
Example: -tags:resolved,invalid issue
status:open - Search for topics that are not closed or archived
Example: status:open question
status:closed - Search for closed topics
Example: status:closed resolved
status:archived - Search for archived topics
Example: status:archived old-feature
status:noreplies - Search for topics with no replies
Example: status:noreplies help
status:single_user - Search for topics with posts from only one user
Example: status:single_user guide
status:public - Search for topics in public categories
Example: status:public announcement
before:{date} - Search for posts before a specific date
Example: before:2021-01-01 legacy
after:{date} - Search for posts after a specific date
Example: after:2022-01-01 new-feature
min_posts:{n} - Search for topics with at least n posts
Example: min_posts:10 discussion
max_posts:{n} - Search for topics with at most n posts
Example: max_posts:5 question
min_views:{n} - Search for topics with at least n views
Example: min_views:1000 popular
max_views:{n} - Search for topics with at most n views
Example: max_views:100 recent
created:@{username} - Search for topics created by a specific user
Example: created:@jane_doe project
with:images - Search for posts containing images
Example: with:images screenshot
filetypes:{extension} - Search for posts with attachments of specific file types
Example: filetypes:pdf,doc report
min_views:{n} - Search for topics with at least n views
Example: min_views:1000 popular
max_views:{n} - Search for topics with at most n views
Example: max_views:100 recent
posts_count:{n} - Search for topics with exactly n posts
Example: posts_count:1 announcement
min_post_count:{n} - Search for topics with at least n posts
Example: min_post_count:20 discussion
max_posts:{n} - Search for topics with at most n posts
Example: max_posts:5 question
You can sort search results using the following options:
order:latest or l - Sort by latest post
Example: bug order:latest
or bug l
order:oldest - Sort by oldest post
Example: feature order:oldest
order:latest_topic - Sort by latest topic
Example: announcement order:latest_topic
order:oldest_topic - Sort by oldest topic
Example: legacy order:oldest_topic
order:views - Sort by number of views
Example: tutorial order:views
order:likes - Sort by number of likes
Example: funny order:likes
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.
Remember that some advanced search options may require certain user permissions or may be limited to specific user roles (e.g., administrators).