Help us shape the future of Go! Take the 2026 Go Developer Survey

go-azsearch

module
v0.0.0-...-6d9cd05 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 25, 2019 License: MIT

README

This is a golang SDK for the Azure Search APIs. It currently only supports searching documents in existing index.

Get started

  1. Use the depedency in your project.
go get -d github.com/vippsas/go-azsearch
  1. Create a client in you app.
import "github.com/vippsas/go-azsearch/azs"

func main() {

	cfg := azs.Config{
		AzsApiKeyType: "",	  // Your Api key type 	(admin or query)
		AzsApiKey: "",		  // Your Api key 		(query key or admin key)
		AzsInstanceName: "",  // Your search instance `https://{instance}.search.windows.net`
	}
	
	cli, err := azs.NewClient(&cfg, http.DefaultClient, func(ctx context.Context) logrus.FieldLogger {
		// You can retrieve your request bound logger here. 
		return logrus.New()
	})
	if err != nil {
		fmt.Println("Failed to init client")
		return
	}
}

  1. Search documents in your index
  var target azs.SearchResponse
	err = cli.Search(context.Background(), "countries", &azs.SearchRequest{Search: "Norwa"}, &target)
	if err != nil {
		// Handle error
	}
	

APIs supported

Supported API
✅ Document search

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL