MCPcopy
hub / github.com/cli/cli / AdvancedIssueSearchString

Method AdvancedIssueSearchString

pkg/search/query.go:146–166  ·  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

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
146func (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
168func formatAdvancedIssueSearch(qualifier string, vs []string) (s []string, applicable bool) {
169 switch qualifier {

Callers 3

SearchQueryBuildFunction · 0.95
searchMethod · 0.80

Calls 3

formatQualifiersFunction · 0.85
formatKeywordsFunction · 0.85
JoinMethod · 0.80

Tested by 1