Hanzo Skills Reference
Hanzo Search Go SDK
Go client library for Hanzo Search. Module `github.com/hanzoai/search-go`, package name `meilisearch`. Index management, document CRUD, filters, facets, highlighting, settings, task monitoring, chat and webhooks.
Overview
Go client library for Hanzo Search. Module path github.com/hanzoai/search-go; the Go package name is meilisearch, matching the wire protocol the server speaks. Provides index management, document CRUD, search with filters/facets/highlighting, settings management, task monitoring, chat, and webhook support.
Repo
hanzoai/search-go, branch: main.
Quick reference
| Item | Value |
|---|---|
| Module | github.com/hanzoai/search-go |
| Package | meilisearch |
| Version | 0.36.1 |
| Go | 1.26+ |
| Repo | github.com/hanzoai/search-go |
| Branch | main |
| License | MIT |
| Protocol | HTTP/REST |
Installation
go get github.com/hanzoai/search-goQuick start
package main
import (
"fmt"
search "github.com/hanzoai/search-go"
)
func main() {
client := search.New("http://localhost:7700", search.WithAPIKey("your-api-key"))
// Create index
task, _ := client.CreateIndex(&search.IndexConfig{
Uid: "movies",
PrimaryKey: "id",
})
fmt.Println("Task:", task.TaskUID)
// Add documents
index := client.Index("movies")
docs := []map[string]interface{}{
{"id": 1, "title": "Carol", "genres": []string{"Romance", "Drama"}},
{"id": 2, "title": "Wonder Woman", "genres": []string{"Action"}},
}
task, _ = index.AddDocuments(docs, nil)
// Search
res, _ := index.Search("wonder", &search.SearchRequest{Limit: 10})
fmt.Println(res.Hits)
}Key features
- Index creation, listing, updating, deletion
- Document add, update, delete (batch and single)
- Full-text search with filters, facets, highlighting, sorting
- Settings management (filterable, sortable, searchable attributes)
- Multi-search across multiple indexes
- Facet search
- Task management (async operations)
- Chat interface (streaming)
- Webhook support
- Content encoding (gzip, deflate, brotli)
- Configurable retries with backoff
- JWT-based tenant tokens
Client options
client := search.New("http://localhost:7700",
search.WithAPIKey("your-api-key"),
search.WithCustomClient(http.DefaultClient),
search.WithContentEncoding(search.GzipEncoding, search.BestCompression),
search.WithCustomRetries([]int{502, 503, 504}, 3),
)| Option | Description |
|---|---|
WithAPIKey | API key for authentication |
WithCustomClient | Custom http.Client |
WithCustomClientWithTLS | Enable TLS |
WithContentEncoding | Request/response encoding |
WithCustomRetries | Retry by status code and max retries |
DisableRetries | Disable automatic retries |
Build and test
go build ./...
go test ./...
# Integration tests require a running Meilisearch instanceHow is this guide?