MCPcopy Create free account
hub / github.com/cli/cli / AdvancedIssueSearchString

Method AdvancedIssueSearchString

pkg/search/query.go:153–173  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

151//
152// The advanced syntax is documented at https://github.blog/changelog/2025-03-06-github-issues-projects-api-support-for-issues-advanced-search-and-more
153func (q Query) AdvancedIssueSearchString() string {
154 qualifiers := strings.Join(formatQualifiers(q.Qualifiers, formatAdvancedIssueSearch), " ")
155 keywords := q.ImmutableKeywords
156 if keywords == "" {
157 keywords = strings.Join(formatKeywords(q.Keywords), " ")
158 }
159
160 if qualifiers == "" && keywords == "" {
161 return ""
162 }
163
164 if qualifiers != "" && keywords != "" {
165 // We should surround keywords with brackets to avoid leaking of any operators, especially "OR"s.
166 return fmt.Sprintf("( %s ) %s", keywords, qualifiers)
167 }
168
169 if keywords != "" {
170 return keywords
171 }
172 return qualifiers
173}
174
175func formatAdvancedIssueSearch(qualifier string, vs []string) (s []string, applicable bool) {
176 switch qualifier {

Callers 3

SearchQueryBuildFunction · 0.95
searchMethod · 0.80

Calls 3

formatQualifiersFunction · 0.85
formatKeywordsFunction · 0.85
JoinMethod · 0.80

Tested by 1