Skip to content

Commit

Permalink
removed with_scores query param
Browse files Browse the repository at this point in the history
  • Loading branch information
KamenDimitrov97 committed Feb 26, 2024
1 parent bfe6895 commit 5850246
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 7 deletions.
7 changes: 0 additions & 7 deletions nlp/berlin/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
33 changes: 33 additions & 0 deletions nlp/main/main.go
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit 5850246

Please sign in to comment.