We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d1e0559 commit 08e9d29Copy full SHA for 08e9d29
1 file changed
pkg/cmd/objects/browse/browse.go
@@ -4,6 +4,7 @@ import (
4
"io"
5
6
"github.com/MakeNowJust/heredoc"
7
+ "github.com/algolia/algoliasearch-client-go/v3/algolia/opt"
8
"github.com/algolia/algoliasearch-client-go/v3/algolia/search"
9
"github.com/spf13/cobra"
10
@@ -71,7 +72,15 @@ func runBrowseCmd(opts *BrowseOptions) error {
71
72
}
73
74
indice := client.InitIndex(opts.Indice)
- res, err := indice.BrowseObjects(opts.SearchParams)
75
+
76
+ // We use the `opt.ExtraOptions` to pass the `SearchParams` to the API.
77
+ query, ok := opts.SearchParams["query"].(string)
78
+ if !ok {
79
+ query = ""
80
+ } else {
81
+ delete(opts.SearchParams, "query")
82
+ }
83
+ res, err := indice.BrowseObjects(opt.Query(query), opt.ExtraOptions(opts.SearchParams))
84
if err != nil {
85
return err
86
0 commit comments