xb

Qdrant Advanced API (English)

English rewrite of xb/doc/QDRANT_ADVANCED_API.md. It documents how xb unifies Recommend, Discover, and Scroll workflows under JsonOfSelect().


1. Feature matrix

API When to use Builder entry
Recommend Rerank positive vs negative feedback NewQdrantBuilder().Recommend(func(*RecommendBuilder)).Build()
Discover Explore content around a context vector NewQdrantBuilder().Discover(func(*DiscoverBuilder)).Build()
Scroll Paginate extremely large collections NewQdrantBuilder().ScrollID(string).Build()

Each API config attaches to the same builder. JsonOfSelect() inspects the state and emits the proper JSON schema automatically.


2. Recommend cheat sheet

json, _ := xb.Of(&FeedVector{}).
    Custom(
        xb.NewQdrantBuilder().
            Recommend(func(rb *xb.RecommendBuilder) {
                rb.Positive(501, 502).
                    Negative(999).
                    Limit(40).
                    WithPayloadSelector(map[string]any{
                        "include": []string{"id", "title"},
                    })
            }).
            Build()
    ).
    Build().
    JsonOfSelect()

3. Discover cheat sheet

json, _ := xb.Of(&ArticleVector{}).
    Custom(
        xb.NewQdrantBuilder().
            Discover(func(db *xb.DiscoverBuilder) {
                db.TargetVector("topic_vec", queryVec).
                    Strategy("best_score").
                    Filter(func(f *xb.QFilterBuilder) {
                        f.MustEq("region", "us")
                    })
            }).
            Build()
    ).
    Build().
    JsonOfSelect()

4. Scroll cheat sheet

json, _ := xb.Of(&FeedVector{}).
    Custom(
        xb.NewQdrantBuilder().
            Scroll(func(sb *xb.ScrollBuilder) {
                sb.PayloadSelector([]string{"id", "tags"}).
                    Limit(100).
                    OffsetID("9012:5")
            })
    ).
    Build().
    JsonOfSelect()

5. Testing and regression


6. Further reading