You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the continuity of this discussion. The Meilisearch Teams has decided to try to bring documentation, logic, and structure of this SDK closer to the others to be more developer-friendly and to have a usage that seems to us more pleasant and more accessible.
Steps
Changing the usage
package main
import (
"fmt""github.com/meilisearch/meilisearch-go""github.com/meilisearch/meilisearch-go/client"
)
funcmain() {
client=meilisearch.NewClient(client.ClientConfig{
Host: "http://127.0.0.1:7700",
MasterKey: "masterKey",
})
// An index is where the documents are stored.index:=client.Index("indexUID")
// If the index 'books' does not exist, MeiliSearch creates it when you first add the documents.documents:= []map[string]interface{}{
{"book_id": 123, "title": "Pride and Prejudice"},
{"book_id": 456, "title": "Le Petit Prince"},
{"book_id": 1, "title": "Alice In Wonderland"},
{"book_id": 1344, "title": "The Hobbit"},
{"book_id": 4, "title": "Harry Potter and the Half-Blood Prince"},
{"book_id": 42, "title": "The Hitchhiker's Guide to the Galaxy"},
}
_, err:=index.addDocuments(documents)
iferr!=nil {
fmt.Println(err)
os.Exit(1)
}
index.Delete()
}
Restructure the file hierarchies
New package structure inspired by what stripe does and following @eskombro guidance:
Uh oh!
There was an error while loading. Please reload this page.
Description
In the continuity of this discussion. The Meilisearch Teams has decided to try to bring documentation, logic, and structure of this SDK closer to the others to be more developer-friendly and to have a usage that seems to us more pleasant and more accessible.
Steps
Changing the usage
Restructure the file hierarchies
New package structure inspired by what stripe does and following @eskombro guidance:
A Client package, which is responsible for:
An Index package, responsible for:
A Custom Error package widely used in the project following previous error handling discussions
Tests
All methods must be well tested a lot
To do
The text was updated successfully, but these errors were encountered: