English remake of xb/doc/VECTOR_DIVERSITY_QDRANT.md. It explains how xb balances recommendation diversity using Qdrant helpers.
| Strategy | Builder helper | Description |
|---|---|---|
| Hash diversity | WithHashDiversity(func(*HashDiversity)) |
Spreads results across payload buckets |
| Score floor | WithMinDistance(float32) |
Drops items below a similarity threshold |
| Payload projection | WithPayloadSelector |
Controls fields returned for downstream rerankers |
custom := xb.NewQdrantBuilder().
WithHashDiversity(func(h *xb.HashDiversity) {
h.Field = "category"
h.Modulo = 4
}).
WithMinDistance(0.35).
Build()
json, _ := xb.Of(&ProductVector{}).
Custom(custom).
VectorSearch("embedding", vec, 12).
Build().
JsonOfSelect()
doc/en/VECTOR_GUIDE.mddoc/en/QDRANT_OPTIMIZATION_SUMMARY.md