Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/algolia/algoliasearch-client-go
⚡️ A fully-featured and blazing-fast Go API client to interact with Algolia.
https://github.com/algolia/algoliasearch-client-go
algolia algolia-search api-client go search
Last synced: about 2 months ago
JSON representation
⚡️ A fully-featured and blazing-fast Go API client to interact with Algolia.
- Host: GitHub
- URL: https://github.com/algolia/algoliasearch-client-go
- Owner: algolia
- License: mit
- Created: 2014-03-14T05:41:02.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2024-04-10T12:12:33.000Z (5 months ago)
- Last Synced: 2024-04-11T10:10:23.293Z (5 months ago)
- Topics: algolia, algolia-search, api-client, go, search
- Language: Go
- Homepage: https://www.algolia.com/doc/api-client/go/getting-started/
- Size: 54.8 MB
- Stars: 198
- Watchers: 86
- Forks: 60
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Security: SECURITY.md
Awesome Lists containing this project
- awesome-blazingly-fast - algoliasearch-client-go - ⚡️ A fully-featured and blazing-fast Go API client to interact with Algolia. (Go)
README
The perfect starting point to integrate Algolia within your Go project
Documentation •
Community Forum •
Stack Overflow •
Report a bug •
FAQ •
Support## ✨ Features
* Support Go 1.11 and above
* Typed requests and responses
* First-class support for user-defined structures
* Injectable HTTP client**Migration note from v2.x to v3.x**
> In June 2019, we released v3 of our Go client. If you are using version 2.x
> of the client, read the [migration guide to version 3.x](https://www.algolia.com/doc/api-client/getting-started/upgrade-guides/go/).
> Version 2.x will **no longer** be under active development.## 💡 Getting Started
First, add the Algolia Go API Client as a new module to your Go project:
```bash
# First line is optional if your project is already defined as a Go module
go mod init
go get github.com/algolia/algoliasearch-client-go/[email protected]
```Then, create objects on your index:
```go
package mainimport "github.com/algolia/algoliasearch-client-go/v3/algolia/search"
type Contact struct {
ObjectID string `json:"objectID"`
Name string `json:"name"`
}func main() {
client := search.NewClient("YourApplicationID", "YourAPIKey")
index := client.InitIndex("your_index_name")res, err := index.SaveObjects([]Contact{
{ObjectID: "1", Name: "Foo"},
})
}
```Finally, you may begin searching a object using the `Search` method:
```go
package mainimport (
"fmt"
"os""github.com/algolia/algoliasearch-client-go/v3/algolia/search"
)type Contact struct {
ObjectID string `json:"objectID"`
Name string `json:"name"`
}func main() {
client := search.NewClient("YourApplicationID", "YourAPIKey")
index := client.InitIndex("your_index_name")res, err := index.Search("Foo")
if err != nil {
fmt.Println(err)
os.Exit(1)
}var contacts []Contact
err = res.UnmarshalHits(&contacts)
if err != nil {
fmt.Println(err)
os.Exit(1)
}fmt.Println(contacts)
}
```For full documentation, visit the **[Algolia Go API Client](https://www.algolia.com/doc/api-client/getting-started/install/go/)**.
## ❓ Troubleshooting
Encountering an issue? Before reaching out to support, we recommend heading to our [FAQ](https://www.algolia.com/doc/api-client/troubleshooting/faq/go/) where you will find answers for the most common issues and gotchas with the client.
## 🐳 Use the DockerfileIf you wish to contribute to the repository but would like to avoid installing the dependencies locally, we provided you with a Docker image.
Please check our [dedicated guide](DOCKER_README.MD) to learn more.## 📄 License
Algolia Go API Client is an open-sourced software licensed under the [MIT license](LICENSE).