fix(pr/shared): delegate query compilation to search package
Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
parent
76b2de8a18
commit
1cd4840199
4 changed files with 8 additions and 14 deletions
|
|
@ -443,7 +443,7 @@ func Test_issueList(t *testing.T) {
|
|||
"owner": "OWNER",
|
||||
"repo": "REPO",
|
||||
"limit": float64(30),
|
||||
"query": "auth bug assignee:@me author:@me mentions:@me repo:OWNER/REPO state:open type:issue",
|
||||
"query": "( auth bug ) assignee:@me author:@me mentions:@me repo:OWNER/REPO state:open type:issue",
|
||||
"type": "ISSUE_ADVANCED",
|
||||
}, params)
|
||||
}))
|
||||
|
|
@ -618,7 +618,7 @@ func TestIssueList_Search_withProjectItems(t *testing.T) {
|
|||
"repo": "REPO",
|
||||
"type": "ISSUE_ADVANCED",
|
||||
"limit": float64(30),
|
||||
"query": "just used to force the search API branch repo:OWNER/REPO type:issue",
|
||||
"query": "( just used to force the search API branch ) repo:OWNER/REPO type:issue",
|
||||
}, params)
|
||||
}))
|
||||
|
||||
|
|
|
|||
|
|
@ -149,7 +149,7 @@ func Test_ListPullRequests(t *testing.T) {
|
|||
httpmock.GraphQL(`query PullRequestSearch\b`),
|
||||
httpmock.GraphQLQuery(`{"data":{}}`, func(query string, vars map[string]interface{}) {
|
||||
want := map[string]interface{}{
|
||||
"q": "one world in:title repo:OWNER/REPO state:open type:pr",
|
||||
"q": "( one world in:title ) repo:OWNER/REPO state:open type:pr",
|
||||
"type": "ISSUE_ADVANCED",
|
||||
"limit": float64(30),
|
||||
}
|
||||
|
|
|
|||
|
|
@ -441,7 +441,7 @@ func TestPRList_Search_withProjectItems(t *testing.T) {
|
|||
}`, func(_ string, params map[string]interface{}) {
|
||||
require.Equal(t, map[string]interface{}{
|
||||
"limit": float64(30),
|
||||
"q": "just used to force the search API branch repo:OWNER/REPO state:open type:pr",
|
||||
"q": "( just used to force the search API branch ) repo:OWNER/REPO state:open type:pr",
|
||||
"type": "ISSUE_ADVANCED",
|
||||
}, params)
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -222,19 +222,13 @@ func SearchQueryBuild(options FilterOptions, advancedIssueSearchSyntax bool) str
|
|||
Is: []string{is},
|
||||
Type: options.Entity,
|
||||
},
|
||||
KeywordsVerbatim: options.Search,
|
||||
}
|
||||
|
||||
var q string
|
||||
if advancedIssueSearchSyntax {
|
||||
q = query.AdvancedIssueSearchString()
|
||||
} else {
|
||||
q = query.StandardSearchString()
|
||||
if !advancedIssueSearchSyntax {
|
||||
return query.StandardSearchString()
|
||||
}
|
||||
|
||||
if options.Search != "" {
|
||||
return fmt.Sprintf("%s %s", options.Search, q)
|
||||
}
|
||||
return q
|
||||
return query.AdvancedIssueSearchString()
|
||||
}
|
||||
|
||||
func QueryHasStateClause(searchQuery string) bool {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue