Skip to content

ffi: batched subset/docset search C ABI surface #137

Description

Summary

Add a C ABI surface for batched subset rerank and docset search once the core Rust APIs are pinned.

This supports ecosystem compatibility by avoiding one FFI call per query/candidate set. ordvec should be a good neighbor to non-Rust hosts while still leaving candidate generation, filtering, query planning, and metadata ownership outside the crate.

Current gap

#115 and #116 track Rust/core APIs for batched subset rerank and caller-owned docset search. Non-Rust hosts will need equivalent C ABI shapes to use those efficiently.

Proposed shape

Sketch only:

typedef struct {
    const float *queries;
    size_t n_queries;
    size_t dim;
    const uint32_t *candidate_ids;
    const size_t *candidate_offsets;
    size_t k;
} ordvec_subset_batch_t;

Docset search can use similar structs for row-id slices or bitset words. Output can use caller-provided buffers or the owned-buffer contract from #136 if that lands.

Acceptance criteria

  • C ABI batched results match repeated single-query calls.
  • Empty rows, invalid row IDs, duplicate candidates, and k > row_len behavior are documented.
  • Status codes cover shape errors and out-of-range IDs without panics crossing the ABI.
  • Go wrapper coverage is added after the ABI is pinned.
  • Capability flags from ffi: C ABI version and capability probes for downstream engines #122 advertise availability.

Non-goals

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestffiFFI / C ABI / cross-language bindings

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions