{"meta":{"title":"搜索讨论","intro":"可以在 GitHub 上搜索讨论，并使用搜索限定符缩小结果范围。","product":"在 GitHub 上搜索","breadcrumbs":[{"href":"/zh/search-github","title":"在 GitHub 上搜索"},{"href":"/zh/search-github/searching-on-github","title":"在 GitHub 上搜索"},{"href":"/zh/search-github/searching-on-github/searching-discussions","title":"搜索讨论"}],"documentType":"article"},"body":"# 搜索讨论\n\n可以在 GitHub 上搜索讨论，并使用搜索限定符缩小结果范围。\n\n## 关于搜索讨论\n\n可以跨所有 GitHub 全局搜索讨论，也可以在特定组织或存储库内搜索讨论。 有关详细信息，请参阅“[关于在GitHub上的搜索](/zh/search-github/getting-started-with-searching-on-github/about-searching-on-github)”。\n\n> \\[!TIP]\n>\n> * 本文包含 GitHub.com 网站上示例搜索的链接，但你可以在任何 GitHub 平台中使用相同的搜索筛选器。 在链接的示例搜索中，将 `github.com` 替换为 GitHub 平台的主机名。\n> * 有关可以添加到任何搜索限定符以进一步改善结果的搜索语法列表，请参阅 [了解搜索语法](/zh/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax)。\n> * 对多个字词的搜索词使用引号。 例如，如果要搜索具有标签“In progress”的问题，可搜索 `label:\"in progress\"`。 搜索不区分大小写。\n\n## 按标题、正文或评论搜索\n\n使用 `in` 限定符可将讨论搜索范围限制在标题、正文或评论中。 您还可以组合限定符来搜索标题、正文或注释的组合。 省略 `in` 限定符时，GitHub 将搜索标题、正文和评论。\n\n| 限定符                                                                                                                           | 示例 |\n| :---------------------------------------------------------------------------------------------------------------------------- | :- |\n| `in:title`                                                                                                                    |    |\n| \\[                                                                                                                            |    |\n| **welcome in:title**]\\(<https://github.com/search?q=welcome+in%3Atitle&type=Discussions>) 匹配标题中包含“welcome”的讨论。                |    |\n| `in:body`                                                                                                                     |    |\n| \\[                                                                                                                            |    |\n| **onboard in:title,body**]\\(<https://github.com/search?q=onboard+in%3Atitle%2Cbody&type=Discussions>) 匹配标题或正文中包含“onboard”的讨论。 |    |\n| `in:comments`                                                                                                                 |    |\n| \\[                                                                                                                            |    |\n| **thanks in:comments**]\\(<https://github.com/search?q=thanks+in%3Acomment&type=Discussions>) 匹配评论中包含“thanks”的讨论。              |    |\n\n## 在用户或组织的仓库内搜索\n\n要在特定用户或组织拥有的所有存储库中搜索讨论，可使用 `user` 或 `org` 限定符。 要在特定存储库中搜索讨论，可使用 `repo` 限定符。\n\n| 限定符                                                                                                                                                                                         | 示例 |\n| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :- |\n| <code>user:<em>USERNAME</em></code>                                                                                                                                                         |    |\n| \\[                                                                                                                                                                                          |    |\n| **user:octocat feedback**]\\(<https://github.com/search?q=user%3Aoctocat+feedback&type=Discussions>) 匹配来自 @octocat 所拥有存储库中包含单词“feedback”的讨论。                                                 |    |\n| <code>org:<em>ORGNAME</em></code>                                                                                                                                                           |    |\n| \\[                                                                                                                                                                                          |    |\n| **org：github**]\\(<https://github.com/search?q=org%3Agithub&type=Discussions&utf8=%E2%9C%93)匹配GitHub组织拥有的存储库中的讨论。>                                                                           |    |\n| <code>repo:<em>USERNAME/REPOSITORY</em></code>                                                                                                                                              |    |\n| \\[                                                                                                                                                                                          |    |\n| **repo:nodejs/node created:<2021-01-01**]\\(<https://github.com/search?q=repo%3Anodejs%2Fnode+created%3A%3C2020-01-01&type=Discussions>) 匹配来自 @nodejs 的 Node.js 运行时项目、且创建时间早于 2021 年 1 月的讨论。 |    |\n\n## 按开放或关闭状态搜索\n\n可以使用 `is` 限定符基于讨论处于打开还是关闭状态对其进行筛选。\n\n| 限定符                                                                                                                                                     | 示例 |\n| ------------------------------------------------------------------------------------------------------------------------------------------------------- | -- |\n| `is:open`                                                                                                                                               |    |\n| \\[                                                                                                                                                      |    |\n| **performance is:open is:discussion**]\\(<https://github.com/search?q=is%3Adiscussion+performance+is%3Aopen&type=discussions>) 匹配包含单词“performance”的开放讨论。 |    |\n| `is:closed`                                                                                                                                             |    |\n| \\[                                                                                                                                                      |    |\n| **android is:closed**]\\(<https://github.com/search?q=android+is%3Aclosed&type=discussions>) 匹配包含单词“android”的已关闭讨论。                                      |    |\n\n## 根据讨论是否得到答复进行搜索\n\n可以使用 `is` 限定符搜索已回答的讨论。\n\n| 限定符                                                                                                                                                              | 示例 |\n| ---------------------------------------------------------------------------------------------------------------------------------------------------------------- | -- |\n| `is:answered`                                                                                                                                                    |    |\n| \\[                                                                                                                                                               |    |\n| **performance is:answered is:discussion**]\\(<https://github.com/search?q=is%3Adiscussion+performance+is%3Aanswered&type=discussions>) 匹配包含单词“performance”的已回答讨论。 |    |\n| `is:unanswered`                                                                                                                                                  |    |\n| **android is:unanswered** 匹配包含“android”一词的未回答的讨论。                                                                                                                |    |\n\n## 根据讨论是否已锁定来进行搜索\n\n可以使用 `is` 限定符搜索已锁定的讨论。 有关详细信息，请参阅“[主持讨论](/zh/discussions/managing-discussions-for-your-community/moderating-discussions)”。\n\n| 限定符                                                                                                                                                               | 示例 |\n| ----------------------------------------------------------------------------------------------------------------------------------------------------------------- | -- |\n| `is:locked`                                                                                                                                                       |    |\n| **\"code of conduct\" is:locked is:discussion** 匹配包含“行为准则”一词的已锁定的讨论。                                                                                                |    |\n| `is:unlocked`                                                                                                                                                     |    |\n| \\[                                                                                                                                                                |    |\n| **code of conduct is:unlocked is:discussion**]\\(<https://github.com/search?q=%22code+of+conduct%22+is%3Aunlocked&type=discussions>) 匹配包含“code of conduct”且未锁定的讨论。 |    |\n\n## 按仓库可见性过滤\n\n可使用 `is` 限定符，按包含讨论的存储库的可见性进行筛选。 有关详细信息，请参阅“[关于仓库](/zh/repositories/creating-and-managing-repositories/about-repositories#about-repository-visibility)”。\n\n| 限定符                                                                                                                                  | 示例 |\n| :----------------------------------------------------------------------------------------------------------------------------------- | :- |\n| `is:public`                                                                                                                          |    |\n| [is:public\\*\\*\\*\\*](https://github.com/search?q=is%3Apublic\\&type=Discussions) 会匹配公共存储库中的讨论。                                         |    |\n|                                                                                                                                      |    |\n| `is:private`                                                                                                                         |    |\n| [is:private tiramisu\\*\\*\\*\\*](https://github.com/search?q=is%3Aprivate+tiramisu\\&type=Discussions) 会匹配你可以访问的专用存储库中包含“tiramisu”一词的讨论。 |    |\n\n## 按作者搜索\n\n`author` 限定符查找由特定用户创建的讨论。\n\n| 限定符                                                                                                                            | 示例 |\n| :----------------------------------------------------------------------------------------------------------------------------- | :- |\n| <code>author:<em>USERNAME</em></code>                                                                                          |    |\n| \\[                                                                                                                             |    |\n| **cool author:octocat**]\\(<https://github.com/search?q=cool+author%3Aoctocat&type=Discussions>) 匹配由 @octocat 创建且包含单词“cool”的讨论。 |    |\n| `in:body`                                                                                                                      |    |\n\n<code>\nauthor:\n<em>\nUSERNAME\n</em>\n</code>\n| \n**bootstrap in:body author:octocat** 匹配由 [](https://github.com/search?q=bootstrap+in%3Abody+author%3Aoctocat&type=Discussions) 创建且正文中含有“bootstrap”一词的讨论。 |\n\n## 按评论者搜索\n\n`commenter` 限定符查找含有特定用户评论的讨论。\n\n| 限定符                                                                                                                                                                                                    | 示例 |\n| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :- |\n| <code>commenter:<em>USERNAME</em></code>                                                                                                                                                               |    |\n| \\[                                                                                                                                                                                                     |    |\n| **github commenter:becca org:github**]\\(<https://github.com/search?utf8=%E2%9C%93&q=github+commenter%3Abecca+org%3Agithub&type=Discussions>) 匹配属于 GitHub 组织的存储库中的讨论，这些讨论包含单词“github”，并且由 @becca 发表过评论。 |    |\n\n## 按已回答讨论的用户进行搜索\n\n`answered-by` 限定符会查找将某位用户的评论标记为答案的讨论。\n\n| 限定符                                                                                                                                 | 示例 |\n| :---------------------------------------------------------------------------------------------------------------------------------- | :- |\n| <code>answered-by:<em>USERNAME</em></code>                                                                                          |    |\n| \\[                                                                                                                                  |    |\n| **cool answered-by:octocat**]\\(<https://github.com/search?q=cool+author%3Aoctocat&type=Discussions>) 匹配由 @octocat 回答且包含单词“cool”的讨论。 |    |\n\n## 按涉及讨论的用户搜索\n\n可使用 `involves` 限定符查找涉及特定用户的讨论。 该限定符返回由特定用户创建、提及该用户或包含该用户评论的讨论。\n`involves` 限定符是 `author`、`mentions` 和 `commenter` 限定符之间的逻辑 OR，用于单个用户。\n\n| 限定符                                                                                                                                                  | 示例 |\n| :--------------------------------------------------------------------------------------------------------------------------------------------------- | :- |\n| <code>involves:<em>USERNAME</em></code>                                                                                                              |    |\n| \\*\\*                                                                                                                                                 |    |\n| [involves:becca involves:octocat](https://github.com/search?q=involves%3Abecca+involves%3Aoctocat\\&type=Discussions)\\*\\* 匹配 @becca 或 @octocat 参与的讨论。 |    |\n| `in:body`                                                                                                                                            |    |\n\n<code>\ninvolves:\n<em>\nUSERNAME\n</em>\n</code>\n| \n[\n**NOT free in:body involves:becca**](https://github.com/search?q=NOT+free+in%3Abody+involves%3Abecca&type=Discussions) 匹配 @becca 参与且正文中不包含单词“free”的讨论。\n\n## 按评论数量搜索\n\n可使用 `comments` 限定符以及大于、小于和范围限定符以按评论数量搜索。 有关详细信息，请参阅“[了解搜索语法](/zh/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax)”。\n\n| 限定符                                                                                                     | 示例 |\n| :------------------------------------------------------------------------------------------------------ | :- |\n| <code>comments:<em>n</em></code>                                                                        |    |\n| \\[                                                                                                      |    |\n| **comments:>100**]\\(<https://github.com/search?q=comments%3A%3E100&type=Discussions>) 匹配评论数超过 100 条的讨论。 |    |\n| <code>comments:<em>n</em></code>                                                                        |    |\n| **comments:500..1000** 匹配包含 500 到 1000 条评论的讨论。                                                          |    |\n\n## 按讨论创建或上次更新时间搜索\n\n您可以基于创建时间或上次更新时间过滤讨论。 对于讨论创建，可使用 `created` 限定符；要了解讨论上次更新的时间，请使用 `updated` 限定符。\n\n两个限定符都使用日期作为参数。 日期格式必须遵循 [ISO8601](http://en.wikipedia.org/wiki/ISO_8601) 标准，即 `YYYY-MM-DD`（年-月-日）。 也可以在日期后添加可选的时间信息 `THH:MM:SS+00:00`，以按小时、分钟和秒进行搜索。 即 `T`，随后是 `HH:MM:SS`（时-分-秒）和 UTC 时差 (`+00:00`)。\n\n搜索日期时，可以使用大于、小于和范围限定符来进一步筛选结果。 有关详细信息，请参阅“[了解搜索语法](/zh/search-github/getting-started-with-searching-on-github/understanding-the-search-syntax)”。\n\n| 限定符                                                                                                                                                                        | 示例 |\n| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :- |\n| <code>created:<em>YYYY-MM-DD</em></code>                                                                                                                                   |    |\n| **created:>2020-11-15** 匹配在 2020 年 11 月 15 日之后创建的讨论。                                                                                                                       |    |\n| <code>updated:<em>YYYY-MM-DD</em></code>                                                                                                                                   |    |\n| \\[                                                                                                                                                                         |    |\n| **weird in:body updated:>=2020-02-01**]\\(<https://github.com/search?q=weird+in%3Abody+updated%3A%3E%3D2020-12-01&type=Discussions>) 匹配正文中包含单词“weird”且在 2020 年 12 月之后更新的讨论。 |    |\n\n## 按类别搜索\n\n可以按特定讨论类别来筛选讨论。\n\n| 限定符                                         | 示例 |\n| :------------------------------------------ | :- |\n| <code>category:<em>CATEGORYNAME</em></code> |    |\n| **category:Ideas** 匹配与名称“Ideas”匹配的讨论类别。     |    |\n\n## 按标签搜索\n\n可以按应用于讨论的特定标签来筛选讨论。\n\n| 限定符    | 示例 |\n| :----- | :- |\n| <code> |    |\n| label: |    |\n\n<em>\n\"LABEL NAME\"\n</em>\n</code>\n| \n**label:\"Product Feedback\"** 匹配与标签“Product Feedback”匹配的讨论。\n\n## 其他阅读材料\n\n* [排序搜索结果](/zh/search-github/getting-started-with-searching-on-github/sorting-search-results)"}