I’m having trouble with the Go client and nearText returning no results. I’ve tried the same query in the Weaviate Console (GraphQL) as well as the Python client. Both of these work fine but when I try the same with the Go client I get no results.
If I eliminate the nearText constraint with the Go client, all results are returned so I know it is connecting.
This is my GraphQL query:
{
Get {
Takeaway (nearText: {concepts: ["Importance of Effective Radio Communications"]} ) {
title
}
}
}
This Go code without the nearText works:
package main
import (
"context"
"fmt"
"github.com/weaviate/weaviate-go-client/v4/weaviate"
"github.com/weaviate/weaviate-go-client/v4/weaviate/graphql"
)
func main() {
cfg := weaviate.Config{
Host: "weaviate:8080",
Scheme: "http",
}
client, err := weaviate.NewClient(cfg)
if err != nil {
panic(err)
}
className := "Takeaway"
title := graphql.Field{Name: "title"}
ctx := context.Background()
result, err := client.GraphQL().Get().
WithClassName(className).
WithFields(title).
Do(ctx)
if err != nil {
panic(err)
}
fmt.Printf("%v", result)
}
Adding the nearText constraint returns no records:
package main
import (
"context"
"fmt"
"github.com/weaviate/weaviate-go-client/v4/weaviate"
"github.com/weaviate/weaviate-go-client/v4/weaviate/graphql"
)
func main() {
cfg := weaviate.Config{
Host: "weaviate:8080",
Scheme: "http",
}
client, err := weaviate.NewClient(cfg)
if err != nil {
panic(err)
}
className := "Takeaway"
title := graphql.Field{Name: "title"}
concepts := []string{"Importance of Effective Radio Communications"}
nearText := client.GraphQL().NearTextArgBuilder().
WithConcepts(concepts)
ctx := context.Background()
result, err := client.GraphQL().Get().
WithClassName(className).
WithFields(title).
WithNearText(nearText).
Do(ctx)
if err != nil {
panic(err)
}
fmt.Printf("%v", result)
}
I’m sure I’m missing something obvious but I can’t figure it out. Any help is appreciated. Thx!