关于搜索讨论
可以跨所有 GitHub 全局搜索讨论,也可以在特定组织或存储库内搜索讨论。 有关详细信息,请参阅“关于在GitHub上的搜索”。
数据重用.search.syntax_tips %}
按标题、正文或评论搜索
使用 in 限定符可将讨论搜索范围限制在标题、正文或评论中。 您还可以组合限定符来搜索标题、正文或注释的组合。 省略 in 限定符时,GitHub 将搜索标题、正文和评论。
| 限定符 | 示例 |
|---|---|
in:title |
[
**welcome in:title**](https://github.com/search?q=welcome+in%3Atitle&type=Discussions) 匹配标题中包含“welcome”的讨论。 |
| in:body |
onboard in:title,body 匹配标题或正文中包含“onboard”的讨论。 |
| in:comments |
thanks in:comments 匹配评论中包含“thanks”的讨论。 |
在用户或组织的仓库内搜索
要在特定用户或组织拥有的所有存储库中搜索讨论,可使用 user 或 org 限定符。 要在特定存储库中搜索讨论,可使用 repo 限定符。
| 限定符 | 示例 |
|---|---|
user:USERNAME |
[
**user:octocat feedback**](https://github.com/search?q=user%3Aoctocat+feedback&type=Discussions) 匹配来自 @octocat 所拥有存储库中包含单词“feedback”的讨论。 |
| org:ORGNAME |
org:github匹配GitHub组织拥有的存储库中的讨论。 |
| repo:USERNAME/REPOSITORY |
repo:nodejs/node created:<2021-01-01 匹配来自 @nodejs 的 Node.js 运行时项目、且创建时间早于 2021 年 1 月的讨论。 |
按开放或关闭状态搜索
可以使用 is 限定符基于讨论处于打开还是关闭状态对其进行筛选。
| 限定符 | 示例 |
|---|---|
is:open |
[
**performance is:open is:discussion**](https://github.com/search?q=is%3Adiscussion+performance+is%3Aopen&type=discussions) 匹配包含单词“performance”的开放讨论。
| is:closed |
android is:closed 匹配包含单词“android”的已关闭讨论。
根据讨论是否得到答复进行搜索
可以使用 is 限定符搜索已回答的讨论。
| 限定符 | 示例 |
|---|---|
is:answered |
[
**performance is:answered is:discussion**](https://github.com/search?q=is%3Adiscussion+performance+is%3Aanswered&type=discussions) 匹配包含单词“performance”的已回答讨论。
| is:unanswered |
android is:unanswered 匹配包含“android”一词的未回答的讨论。
根据讨论是否已锁定来进行搜索
可以使用 is 限定符搜索已锁定的讨论。 有关详细信息,请参阅“主持讨论”。
| 限定符 | 示例 |
|---|---|
is:locked |
**"code of conduct" is:locked is:discussion** 匹配包含“行为准则”一词的已锁定的讨论。
| is:unlocked |
code of conduct is:unlocked is:discussion 匹配包含“code of conduct”且未锁定的讨论。
按仓库可见性过滤
可使用 is 限定符,按包含讨论的存储库的可见性进行筛选。 有关详细信息,请参阅“关于仓库”。
| 限定符 | 示例 |
|---|---|
is:public |
[is:public****](https://github.com/search?q=is%3Apublic&type=Discussions) 会匹配公共存储库中的讨论。 |
| |
| is:private |
is:private tiramisu**** 会匹配你可以访问的专用存储库中包含“tiramisu”一词的讨论。
按作者搜索
`author` 限定符查找由特定用户创建的讨论。
| 限定符 | 示例 |
|---|---|
author:USERNAME |
[
**cool author:octocat**](https://github.com/search?q=cool+author%3Aoctocat&type=Discussions) 匹配由 @octocat 创建且包含单词“cool”的讨论。 |
|
in:body
author:
USERNAME
|
bootstrap in:body author:octocat 匹配由 创建且正文中含有“bootstrap”一词的讨论。 |
按评论者搜索
`commenter` 限定符查找含有特定用户评论的讨论。
| 限定符 | 示例 |
|---|---|
commenter:USERNAME |
[
**github commenter:becca org:github**](https://github.com/search?utf8=%E2%9C%93&q=github+commenter%3Abecca+org%3Agithub&type=Discussions) 匹配属于 GitHub 组织的存储库中的讨论,这些讨论包含单词“github”,并且由 @becca 发表过评论。
按已回答讨论的用户进行搜索
`answered-by` 限定符会查找将某位用户的评论标记为答案的讨论。
| 限定符 | 示例 |
|---|---|
answered-by:USERNAME |
[
**cool answered-by:octocat**](https://github.com/search?q=cool+author%3Aoctocat&type=Discussions) 匹配由 @octocat 回答且包含单词“cool”的讨论。 |
按涉及讨论的用户搜索
可使用 involves 限定符查找涉及特定用户的讨论。 该限定符返回由特定用户创建、提及该用户或包含该用户评论的讨论。
involves 限定符是 author、mentions 和 commenter 限定符之间的逻辑 OR,用于单个用户。
| 限定符 | 示例 |
|---|---|
involves:USERNAME |
**
[involves:becca involves:octocat](https://github.com/search?q=involves%3Abecca+involves%3Aoctocat&type=Discussions)** 匹配 @becca 或 @octocat 参与的讨论。
|
in:body
involves:
USERNAME
|
NOT free in:body involves:becca 匹配 @becca 参与且正文中不包含单词“free”的讨论。
按评论数量搜索
可使用 comments 限定符以及大于、小于和范围限定符以按评论数量搜索。 有关详细信息,请参阅“了解搜索语法”。
| 限定符 | 示例 |
|---|---|
comments:n |
[
**comments:>100**](https://github.com/search?q=comments%3A%3E100&type=Discussions) 匹配评论数超过 100 条的讨论。
| comments:n |
comments:500..1000 匹配包含 500 到 1000 条评论的讨论。
按讨论创建或上次更新时间搜索
您可以基于创建时间或上次更新时间过滤讨论。 对于讨论创建,可使用 created 限定符;要了解讨论上次更新的时间,请使用 updated 限定符。
两个限定符都使用日期作为参数。 日期格式必须遵循 ISO8601 标准,即 YYYY-MM-DD(年-月-日)。也可以在日期后添加可选的时间信息 THH:MM:SS+00:00,以按小时、分钟和秒进行搜索。 即 T,随后是 HH:MM:SS(时-分-秒)和 UTC 时差 (+00:00)。
搜索日期时,可以使用大于、小于和范围限定符来进一步筛选结果。 有关详细信息,请参阅“了解搜索语法”。
| 限定符 | 示例 |
|---|---|
created:YYYY-MM-DD |
**created:>2020-11-15** 匹配在 2020 年 11 月 15 日之后创建的讨论。
| updated:YYYY-MM-DD |
weird in:body updated:>=2020-02-01 匹配正文中包含单词“weird”且在 2020 年 12 月之后更新的讨论。
按类别搜索
可以按特定讨论类别来筛选讨论。
| 限定符 | 示例 |
|---|---|
category:CATEGORYNAME |
**category:Ideas** 匹配与名称“Ideas”匹配的讨论类别。
按标签搜索
可以按应用于讨论的特定标签来筛选讨论。
| 限定符 | 示例 |
|---|
<code>
label:
<em>
"LABEL NAME"
</em>
</code>
|
**label:"Product Feedback"** 匹配与标签“Product Feedback”匹配的讨论。
其他阅读材料
-
[AUTOTITLE](/search-github/getting-started-with-searching-on-github/sorting-search-results)