refactor example
This commit is contained in:
parent
95120c77b1
commit
5475060a69
1 changed files with 0 additions and 0 deletions
30
cmd/example/main.go
Normal file
30
cmd/example/main.go
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/expectedsh/go-sonic/sonic"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
||||
ingester, err := sonic.NewIngester("localhost", 1491, "SecretPassword")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// I will ignore all errors for demonstration purposes
|
||||
|
||||
_ = ingester.Push("movies", "general", "id:6ab56b4kk3", "Star wars")
|
||||
_ = ingester.Push("movies", "general", "id:5hg67f8dg5", "Spider man")
|
||||
_ = ingester.Push("movies", "general", "id:1m2n3b4vf6", "Batman")
|
||||
_ = ingester.Push("movies", "general", "id:68d96h5h9d0", "This is another movie")
|
||||
|
||||
search, err := sonic.NewSearch("localhost", 1491, "SecretPassword")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
results, _ := search.Query("movies", "general", "man", 10, 0)
|
||||
|
||||
fmt.Println(results)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue