docs(search): improve Searcher.URL method docs

Signed-off-by: Babak K. Shandiz <babakks@github.com>
This commit is contained in:
Babak K. Shandiz 2025-08-31 15:36:31 +01:00
parent 3573fdfbb0
commit 04cce6b35e
No known key found for this signature in database
GPG key ID: 9472CAEFF56C742E

View file

@ -263,11 +263,18 @@ func (s searcher) search(query Query, result interface{}) (*http.Response, error
return resp, nil
}
// URL returns URL to the global search in web GUI (i.e. github.com/search).
func (s searcher) URL(query Query) string {
path := fmt.Sprintf("https://%s/search", s.host)
qs := url.Values{}
qs.Set("type", query.Kind)
// TODO(babakks): currently, the global search GUI does not support the
// advanced issue search syntax (even for the issues/PRs tab on the
// sidebar). When the GUI is updated, we can use feature detection, and, if
// available, use the advanced search syntax.
qs.Set("q", query.String())
if query.Order != "" {
qs.Set(orderKey, query.Order)
}