Select API:
C++ API |
C Stable ABI
C++ API Reference
SearchEngine Class
// Open
static StatusOr<unique_ptr<SearchEngine>> Open(const SearchEngineConfig& cfg);
// Upsert
Status Upsert(string_view key, VectorView vec, Metadata meta = {},
optional<milliseconds> ttl = nullopt, optional<string> text = nullopt);
// Search
StatusOr<vector<ResultItem>> Search(VectorView q, QueryOptions opt);
// Hybrid Search
StatusOr<vector<ResultItem>> SearchHybrid(const HybridQuery& query);
Key Structures
SearchEngineConfig
struct SearchEngineConfig {
int dim = 0;
IndexType index_type = IndexType::Flat; // Flat, Hnsw, IvfFlat, IvfSq8
Similarity similarity = Similarity::Dot;
int num_shards = 1;
bool enable_avx2 = true;
// ... HNSW & IVF params
};
Thread Safety
- Concurrent Reads: Safe.
- Concurrent Writes: Safe (internally synchronized).
- Read during Write: Safe (readers see consistent state).
C Stable ABI
Safe wrapper for binding Rust, Go, Python, Node.
Ownership Rules
- Caller must not free memory returned by C API directly.
- Use specific free functions:
pomai_search_results_free(),pomai_search_engine_close(). - Pointers in
pomai_search_hit_tare valid only while the owning result object is alive.
Status Model
- All functions return
pomai_search_status_code_t. NULLstatus implies success.
Build & Link
find_package(pomai_search REQUIRED)
target_link_libraries(my_app PRIVATE pomai_search_c)