diff --git a/pkg/cmd/pr/shared/params.go b/pkg/cmd/pr/shared/params.go index 94fe5f4b1..e0ea9f105 100644 --- a/pkg/cmd/pr/shared/params.go +++ b/pkg/cmd/pr/shared/params.go @@ -222,7 +222,7 @@ func SearchQueryBuild(options FilterOptions, advancedIssueSearchSyntax bool) str Is: []string{is}, Type: options.Entity, }, - KeywordsVerbatim: options.Search, + ImmutableKeywords: options.Search, } if !advancedIssueSearchSyntax { diff --git a/pkg/search/query.go b/pkg/search/query.go index 1fb777058..f6e7fc05d 100644 --- a/pkg/search/query.go +++ b/pkg/search/query.go @@ -21,14 +21,15 @@ type Query struct { // as needed. This is useful when the input can be supplied as a list of // search keywords. // - // This field is mutually exclusive with KeywordsVerbatim. + // This field is overridden by ImmutableKeywords. Keywords []string - // KeywordsVerbatim holds the search keywords as a single string, and will + + // ImmutableKeywords holds the search keywords as a single string, and will // be treated as is (e.g. no additional quoting). This is useful when the // input is meant to be taken verbatim from the user. // - // This field is mutually exclusive with Keywords. - KeywordsVerbatim string + // This field takes precedence over Keywords. + ImmutableKeywords string Kind string Limit int @@ -117,8 +118,8 @@ type Qualifiers struct { func (q Query) StandardSearchString() string { qualifiers := formatQualifiers(q.Qualifiers, nil) var keywords []string - if q.KeywordsVerbatim != "" { - keywords = []string{q.KeywordsVerbatim} + if q.ImmutableKeywords != "" { + keywords = []string{q.ImmutableKeywords} } else if ks := formatKeywords(q.Keywords); len(ks) > 0 { keywords = ks } @@ -143,7 +144,7 @@ func (q Query) StandardSearchString() string { // The advanced syntax is documented at https://github.blog/changelog/2025-03-06-github-issues-projects-api-support-for-issues-advanced-search-and-more func (q Query) AdvancedIssueSearchString() string { qualifiers := strings.Join(formatQualifiers(q.Qualifiers, formatAdvancedIssueSearch), " ") - keywords := q.KeywordsVerbatim + keywords := q.ImmutableKeywords if keywords == "" { keywords = strings.Join(formatKeywords(q.Keywords), " ") } diff --git a/pkg/search/query_test.go b/pkg/search/query_test.go index 928db084e..db6934ba0 100644 --- a/pkg/search/query_test.go +++ b/pkg/search/query_test.go @@ -75,29 +75,29 @@ func TestStandardSearchString(t *testing.T) { out: `topic:"quote qualifier"`, }, { - name: "respects verbatim keywords", + name: "respects immutable keywords", query: Query{ - KeywordsVerbatim: "verbatim keyword that should be left as is", + ImmutableKeywords: "immutable keyword that should be left as is", }, - out: `verbatim keyword that should be left as is`, + out: `immutable keyword that should be left as is`, }, { - name: "respects verbatim keywords, with qualifiers", + name: "respects immutable keywords, with qualifiers", query: Query{ - KeywordsVerbatim: "verbatim keyword that should be left as is", + ImmutableKeywords: "immutable keyword that should be left as is", Qualifiers: Qualifiers{ Topic: []string{"quote qualifier"}, }, }, - out: `verbatim keyword that should be left as is topic:"quote qualifier"`, + out: `immutable keyword that should be left as is topic:"quote qualifier"`, }, { - name: "prioritises verbatim keywords over keywords slice", + name: "prioritises immutable keywords over keywords slice", query: Query{ - Keywords: []string{"foo", "bar"}, - KeywordsVerbatim: "verbatim keyword", + Keywords: []string{"foo", "bar"}, + ImmutableKeywords: "immutable keyword", }, - out: `verbatim keyword`, + out: `immutable keyword`, }, } for _, tt := range tests { @@ -141,29 +141,29 @@ func TestAdvancedIssueSearchString(t *testing.T) { out: `label:"quote qualifier"`, }, { - name: "respects verbatim keywords", + name: "respects immutable keywords", query: Query{ - KeywordsVerbatim: "verbatim keyword that should be left as is", + ImmutableKeywords: "immutable keyword that should be left as is", }, - out: `verbatim keyword that should be left as is`, + out: `immutable keyword that should be left as is`, }, { - name: "respects verbatim keywords, with qualifiers", + name: "respects immutable keywords, with qualifiers", query: Query{ - KeywordsVerbatim: "verbatim keyword that should be left as is", + ImmutableKeywords: "immutable keyword that should be left as is", Qualifiers: Qualifiers{ Topic: []string{"quote qualifier"}, }, }, - out: `( verbatim keyword that should be left as is ) topic:"quote qualifier"`, + out: `( immutable keyword that should be left as is ) topic:"quote qualifier"`, }, { - name: "prioritises verbatim keywords over keywords slice", + name: "prioritises immutable keywords over keywords slice", query: Query{ - Keywords: []string{"foo", "bar"}, - KeywordsVerbatim: "verbatim keyword", + Keywords: []string{"foo", "bar"}, + ImmutableKeywords: "immutable keyword", }, - out: `verbatim keyword`, + out: `immutable keyword`, }, { name: "unused qualifiers should not appear in query",