# searchSDK for C++

C++17 over the C11 / POSIX ABI. Typed RAII facade over the C SDK: 14 normalized web-search adapters and 493 retained native bindings across 13 providers; gateway client.

Canonical: https://searchsdk.dev/docs/sdks/cpp
Markdown: https://searchsdk.dev/docs/sdks/cpp.md

<a id="install"></a>

## Install from source

Package: `searchsdk::cpp / searchsdk::cpp_curl`, version `0.1.0-alpha.1`. This is an alpha source/local-artifact installation. No public registry release or release tag is assumed.

**Get the source**

```bash
git clone https://github.com/Belweave/searchSDK.git
cd searchSDK
# Record this revision with your application's dependency lock.
git rev-parse HEAD
```

**Build or install the local package**

```bash
cmake -S packages/cpp -B .local/cpp-build -DCMAKE_BUILD_TYPE=Release -DSEARCHSDK_CPP_CURL=ON
cmake --build .local/cpp-build --parallel 2
cmake --install .local/cpp-build --prefix "$PWD/.local/cpp-install"
```

Use find_package(searchsdk_cpp 0.1 CONFIG REQUIRED) and link searchsdk::cpp_curl. The default build includes the sibling C library; C and C++ compiler, architecture and runtime settings must be compatible.

<a id="first-search"></a>

## Make a server-side search

Set provider keys in your application's server environment or secret store. The example below makes a real provider request when invoked and can incur charges. Use the package's fixture consumer for a key-free check.

**search.cpp**

```cpp
#include <searchsdk/searchsdk.hpp>
#include <searchsdk/curl.hpp>
#include <iostream>

void search_example(const std::string& server_key) {
    searchsdk::Config config;
    config.provider = "exa";
    config.transport = searchsdk::curl_transport();
    searchsdk::Client search(std::move(config));
    searchsdk::CallOptions call;
    call.credential = server_key;
    const auto response = search.search(
        searchsdk::SearchRequest{"SQLite write concurrency", 3}, call);
    for (const auto& result : response.results)
        std::cout << result.url << '\n';
}
```

Call from your server application with an application-supplied provider key. Configure the curl transport before starting worker threads, and destroy clients after joining their calls. Results own their data.

<a id="scope"></a>

## Supported surface and limits

Typed RAII facade over the C SDK: 14 normalized web-search adapters and 493 retained native bindings across 13 providers; gateway client.

- A C++17 facade over the C ABI, not an independent Windows transport.
- Synchronous API and owning stream callbacks; no hidden async executor.

Preserve result order, provider-native scores and source provenance. Unknown usage is not zero cost. Cancellation and deadlines cannot undo a request already accepted by a remote system or guarantee exactly-once effects.

<a id="verify"></a>

## Verify without provider keys

**Repository checkout · local checks**

```bash
cmake -S packages/cpp -B .local/cpp-check -DCMAKE_BUILD_TYPE=Release
cmake --build .local/cpp-check --parallel 2
ctest --test-dir .local/cpp-check --output-on-failure
```

Typed wire models, sanitizers, local TLS and consumers using installed C and relocated CPack archives.

These are deterministic contract and artifact checks. They do not establish live-provider or account-entitlement verification. Read the package README for precise commands, dependencies and runtime coverage.

<a id="next"></a>

## Continue in your language

- [C++ package reference](https://github.com/Belweave/searchSDK/tree/main/packages/cpp#readme): Complete API, errors, streaming, packaging and platform boundaries.
- [Compare SDKs](https://searchsdk.dev/docs/sdks)
- [Choose a provider](https://searchsdk.dev/docs/providers)
