diff --git a/nlp/berlin/options.go b/nlp/berlin/options.go index 6156b20c..6c479430 100644 --- a/nlp/berlin/options.go +++ b/nlp/berlin/options.go @@ -47,13 +47,6 @@ func (o *Options) Limit(val string) *Options { return o } -// Limit sets the 'limit' Query parameter to the request -// Optional default is 0(false) -func (o *Options) WithScores(val string) *Options { - o.Query.Set("with_scores", val) - return o -} - func setHeaders(req *http.Request, headers http.Header) { for name, values := range headers { for _, value := range values { diff --git a/nlp/main/main.go b/nlp/main/main.go new file mode 100644 index 00000000..a5147ea9 --- /dev/null +++ b/nlp/main/main.go @@ -0,0 +1,33 @@ +package main + +import ( + "context" + "fmt" + + "github.com/ONSdigital/dp-api-clients-go/v2/nlp/berlin" +) + +func main() { + + // Initialize the Berlin API client + client := berlin.New("http://localhost:28900") + + // Create an Options struct and set a query parameter 'q' + // you can also use url.Values directly into the Options + options := berlin.OptInit() + fmt.Println(options) + + options.Q("dentists in london with something") + fmt.Println(options) + + // Get Berlin results using the created client and custom options + results, err := client.GetBerlin(context.TODO(), options) + fmt.Println(err) + fmt.Println(results.Matches) + fmt.Println(results.Matches[0].Scores.Score) + fmt.Println(results.Matches[0].Scores.Offset) + fmt.Println(results.Matches[0].Loc.Codes) + fmt.Println(results.Matches[0].Loc.Encoding) + fmt.Println(results.Matches[0].Loc.ID) + fmt.Println(results.Query) +}