C++ · Retrieval and Streaming

Retrieval and Streaming

#include <usearch/dense_index.hpp> 3.0.0-rc.1 · 4c3e5023

Every verb takes the library's argument struct, so the caller names the inputs with designated initializers. The wrapper fills the handle, executor, arena and outcome slots, runs the call to completion, and returns the verb's first output beside the outcome, while any further output stays a pointer the caller sets in the struct.

namespace us = unum::usearch;
auto [executor, executor_status, executor_message] = us::executor_t::for_ram();
auto [index, index_status, index_message] = us::dense_index_t::init_ram({
    .metric = usearch_dense_metric_angular_k, .quantization = usearch_scalar_bf16_k,
    .dimensions = 256});
auto [arena, arena_status, arena_message] = us::arena_t::make({.executor = executor.handle()});
auto [matches, status, message] = index.search(
    {.count = 1, .queries = {query, 0, 256, usearch_scalar_f32_k}, .wanted = 10}, arena,
    executor);

API

Types

dense_cursor_tOwns one cursor, opened by dense_index_t::cursor_init.
dense_index.hpp:171 ↗
class dense_cursor_t
dense_search_stream_tOwns one search stream, opened by dense_index_t::search_stream_init.
dense_index.hpp:188 ↗
class dense_search_stream_t