Files
landing_page/qdrant-landing/content/documentation/headless/snippets/query-points/hybrid-mmr/go.md
T
Luis CossíoandAnush 33c9c18f9a [v1.15.0] MMR docs (#1754)
* add mmr to hybrid queries section

* update to new interface

* proofread

* update for renaming `lambda` into `diversity`

* update for `candidates_limit`

* add formula

* fix rust snippet

* docs: Simplified go.md

* docs: Simplify csharp.md

* docs: Simplified java.md

* output is regular scores

---------

Co-authored-by: Anush <anushshetty90@gmail.com>
2025-07-18 13:24:16 +02:00

546 B

import (
	"context"

	"github.com/qdrant/go-client/qdrant"
)

client, err := qdrant.NewClient(&qdrant.Config{
	Host: "localhost",
	Port: 6334,
})

client.Query(context.Background(), &qdrant.QueryPoints{
	CollectionName: "{collection_name}",
	Query: qdrant.NewQueryMMR(
		qdrant.NewVectorInput(0.01, 0.45, 0.67),
		&qdrant.Mmr{
			Diversity:       qdrant.PtrOf(float32(0.5)), // 0.0 - relevance; 1.0 - diversity
			CandidatesLimit: qdrant.PtrOf(uint32(100)),  // num of candidates to preselect
		}),
	Limit: qdrant.PtrOf(uint64(10)),
})