AdvancedIssueSearchString returns the string representation of the query compatible with the advanced issue search syntax. The query can be used in Issues tab (of repositories) and the Issues dashboard (i.e. github.com/issues). As the name suggests, this query syntax is only supported for searching
()
| 144 | // |
| 145 | // The advanced syntax is documented at https://github.blog/changelog/2025-03-06-github-issues-projects-api-support-for-issues-advanced-search-and-more |
| 146 | func (q Query) AdvancedIssueSearchString() string { |
| 147 | qualifiers := strings.Join(formatQualifiers(q.Qualifiers, formatAdvancedIssueSearch), " ") |
| 148 | keywords := q.ImmutableKeywords |
| 149 | if keywords == "" { |
| 150 | keywords = strings.Join(formatKeywords(q.Keywords), " ") |
| 151 | } |
| 152 | |
| 153 | if qualifiers == "" && keywords == "" { |
| 154 | return "" |
| 155 | } |
| 156 | |
| 157 | if qualifiers != "" && keywords != "" { |
| 158 | // We should surround keywords with brackets to avoid leaking of any operators, especially "OR"s. |
| 159 | return fmt.Sprintf("( %s ) %s", keywords, qualifiers) |
| 160 | } |
| 161 | |
| 162 | if keywords != "" { |
| 163 | return keywords |
| 164 | } |
| 165 | return qualifiers |
| 166 | } |
| 167 | |
| 168 | func formatAdvancedIssueSearch(qualifier string, vs []string) (s []string, applicable bool) { |
| 169 | switch qualifier { |