diff --git a/bindings/c/include/svs/c/svs_c.h b/bindings/c/include/svs/c/svs_c.h index e8b69c30d..2b337a7e9 100644 --- a/bindings/c/include/svs/c/svs_c.h +++ b/bindings/c/include/svs/c/svs_c.h @@ -55,6 +55,9 @@ enum svs_error_code { SVS_ERROR_UNSUPPORTED_HW = 6, SVS_ERROR_RUNTIME = 7, SVS_ERROR_INVALID_OPERATION = 8, + /// A search was stopped by the callback set with + /// svs_search_params_set_cancel_callback(). + SVS_ERROR_CANCELLED = 9, SVS_ERROR_UNKNOWN = 1000 }; @@ -933,6 +936,37 @@ SVS_API svs_search_params_h svs_search_params_create_vamana( /// @param params The search parameters handle to free SVS_API void svs_search_params_free(svs_search_params_h params); +/// @brief Cancellation predicate for searches. +/// @param userdata The opaque pointer given to svs_search_params_set_cancel_callback() +/// @return true to ask the search to stop, false to let it continue +/// @remarks The callback must not throw or longjmp out of the library, and must not call +/// back into the SVS C API. +typedef bool (*svs_is_cancelled_fn)(void* userdata); + +/// @brief Set a callback that lets the caller interrupt searches that use @p params +/// @details Used by svs_index_search_topk() (also filtered). It is polled once at call +/// start, once per visited node, and per query and per batch for filtered search. It may be +/// called concurrently from several threads, so it must be thread-safe and cheap. After it +/// returns true, other threads may still call it a few more times before they stop. The +/// search then returns false with SVS_ERROR_CANCELLED and @c out_results holds, per query, +/// the neighbors found so far (possibly fewer than k; queries that had not started when the +/// cancel fired may hold a few candidates). If the callback already returns true when the +/// call starts, no search is run and @c out_results holds no results. A call can be +/// reported cancelled even if it had finished. +/// @param params The search parameters handle +/// @param fn The cancellation predicate, or NULL to remove a previously set callback +/// @param userdata Opaque pointer passed to @p fn on every call; the caller owns it and +/// it must stay valid for every search that uses @p params while the callback is set +/// @param out_err An optional error handle to capture errors +/// @return true on success, false on failure +/// @error SVS_ERROR_INVALID_ARGUMENT if @p params is NULL +SVS_API bool svs_search_params_set_cancel_callback( + svs_search_params_h params, + svs_is_cancelled_fn fn, + void* userdata, + svs_error_h out_err /*=NULL*/ +); + /// @brief Create a simple storage configuration /// @param data_type The data type of the vectors /// @param out_err An optional error handle to capture errors @@ -1513,6 +1547,8 @@ SVS_API bool svs_index_get_size( /// @return true on success, false on failure /// @error SVS_ERROR_NOT_IMPLEMENTED if @p index is a dynamic index with /// SVS_SYNC_KIND_FINE_GRAIN and @p num_queries is greater than 1 +/// @error SVS_ERROR_CANCELLED if the cancel callback of @p search_params returned true; +/// @p out_results then holds partial results (see svs_search_params_set_cancel_callback()) SVS_API bool svs_index_search_topk( svs_index_h index, const float* queries, diff --git a/bindings/c/src/algorithm.hpp b/bindings/c/src/algorithm.hpp index ca0de8b2d..1c852001c 100644 --- a/bindings/c/src/algorithm.hpp +++ b/bindings/c/src/algorithm.hpp @@ -28,6 +28,9 @@ namespace svs::c_runtime { struct Algorithm { struct SearchParams { svs_algorithm_type type; + // Set by svs_search_params_set_cancel_callback(); polled by searches. + svs_is_cancelled_fn cancel_fn = nullptr; + void* cancel_userdata = nullptr; SearchParams(svs_algorithm_type type) : type(type) {} virtual ~SearchParams() = default; diff --git a/bindings/c/src/filtered_search.hpp b/bindings/c/src/filtered_search.hpp index 8e45ac691..15e8b9349 100644 --- a/bindings/c/src/filtered_search.hpp +++ b/bindings/c/src/filtered_search.hpp @@ -152,6 +152,8 @@ inline void set_empty_result(svs::QueryResult& result) { // keeping only those that pass the filter. The batch size is estimated adaptively based on // the observed hit rate. Results are written into `results`. // returns a vector containing the number of neighbors found for each query. +// Once `cancel` returns true the search stops. Each row then holds the neighbors accepted +// so far (the returned count), followed by padding; queries that never started have 0. template std::vector filtered_topk_search( IndexType& index, @@ -159,7 +161,8 @@ std::vector filtered_topk_search( svs::data::ConstSimpleDataView queries, size_t initial_batch_hint, const IDFilterInterface* id_filter, - const std::function& sample_generator + const std::function& sample_generator, + const svs::lib::DefaultPredicate& cancel ) { // Minimum number of samples to estimate the filter hit rate. This is a trade-off // between accuracy and performance. A larger sample size gives a more accurate @@ -193,6 +196,9 @@ std::vector filtered_topk_search( auto search_closure = [&](const auto& range, uint64_t SVS_UNUSED(tid)) { for (auto i : range) { + if (cancel()) { + return; + } auto query = queries.get_datum(i); auto iterator = index.batch_iterator(query); size_t found = 0; @@ -202,7 +208,9 @@ std::vector filtered_topk_search( batch_size = estimate_batch_size( total_checked, found, num_neighbors, batch_size, index_size ); - iterator.next(batch_size); + iterator.next(batch_size, cancel); + // After a cancel, results() still holds the valid prefix of the batch + // with external IDs; keep what passes the filter and stop below. total_checked += iterator.size(); for (auto& neighbor : iterator.results()) { if (id_filter->is_member(neighbor.id())) { @@ -213,6 +221,9 @@ std::vector filtered_topk_search( } } } + if (found < num_neighbors && cancel()) { + break; + } // TODO: clarify the contract here - should we return partial or no // result if the hit rate is too low if (found < num_neighbors && diff --git a/bindings/c/src/index.hpp b/bindings/c/src/index.hpp index 577520780..70e2aecb8 100644 --- a/bindings/c/src/index.hpp +++ b/bindings/c/src/index.hpp @@ -49,7 +49,8 @@ struct Index { svs::data::ConstSimpleDataView queries, size_t num_neighbors, const std::shared_ptr& search_params, - const IDFilterInterface* id_filter = nullptr + const IDFilterInterface* id_filter = nullptr, + const lib::DefaultPredicate& cancel = lib::Returns(lib::Const()) ) = 0; virtual void save(const std::filesystem::path& directory) = 0; virtual void save(std::ostream& stream) = 0; diff --git a/bindings/c/src/index_vamana.cpp b/bindings/c/src/index_vamana.cpp index addc5eb34..2f4872e15 100644 --- a/bindings/c/src/index_vamana.cpp +++ b/bindings/c/src/index_vamana.cpp @@ -55,11 +55,38 @@ IndexVamana::IndexVamana(const IndexBuilder& builder, svs::Vamana&& index) this->index.set_search_parameters(params); } +namespace { +// Move the entries that hold a real ID to the front of each row (IDs and distances +// together, as the CSR exporter consumes each row's counted prefix) and set the per-row +// found counts. Slots left empty by a concurrent consolidation or by a cancelled search +// hold `no_external_id`. +void compact_found( + svs::QueryResult& results, std::vector& found_per_query +) { + for (size_t i = 0; i < results.n_queries(); ++i) { + size_t found = 0; + for (size_t j = 0; j < results.n_neighbors(); ++j) { + const auto id = results.index(i, j); + if (id == svs::index::vamana::concurrent::no_external_id) { + continue; + } + if (found != j) { + results.index(i, found) = id; + results.distance(i, found) = results.distance(i, j); + } + ++found; + } + found_per_query[i] = found; + } +} +} // namespace + std::pair, std::vector> IndexVamana::search( svs::data::ConstSimpleDataView queries, size_t num_neighbors, const std::shared_ptr& search_params, - const IDFilterInterface* id_filter + const IDFilterInterface* id_filter, + const lib::DefaultPredicate& cancel ) { auto vamana_search_params = std::static_pointer_cast(search_params); @@ -71,9 +98,13 @@ std::pair, std::vector> IndexVamana::search( } if (id_filter == nullptr) { - index.search(results.view(), queries, params); - // assuming all neighbors found - return {results, std::vector(queries.size(), num_neighbors)}; + index.search(results.view(), queries, params, cancel); + auto found_neighbors_per_query = std::vector(queries.size(), num_neighbors); + if (cancel()) { + // Cancelled slots hold no_external_id. + compact_found(results, found_neighbors_per_query); + } + return {results, std::move(found_neighbors_per_query)}; } std::mt19937 rng(42); @@ -84,7 +115,7 @@ std::pair, std::vector> IndexVamana::search( std::max(num_neighbors, params.buffer_config_.get_search_window_size()); auto found_neighbors_per_query = filtered_topk_search( - index, results, queries, batch_hint, id_filter, sample_generator + index, results, queries, batch_hint, id_filter, sample_generator, cancel ); return {results, found_neighbors_per_query}; } @@ -119,7 +150,8 @@ std::pair, std::vector> DynamicIndexVamana::sea svs::data::ConstSimpleDataView queries, size_t num_neighbors, const std::shared_ptr& search_params, - const IDFilterInterface* id_filter + const IDFilterInterface* id_filter, + const lib::DefaultPredicate& cancel ) { auto lock = read_lock(); auto vamana_search_params = @@ -132,26 +164,11 @@ std::pair, std::vector> DynamicIndexVamana::sea } if (id_filter == nullptr) { - index.search(results.view(), queries, params); + index.search(results.view(), queries, params, cancel); auto found_neighbors_per_query = std::vector(queries.size(), num_neighbors); - if (sync_kind == SVS_SYNC_KIND_FINE_GRAIN) { - // Consolidation can erase buffered IDs before translation. The CSR exporter - // consumes each row's counted prefix, so move IDs and distances together. - for (size_t i = 0; i < results.n_queries(); ++i) { - size_t found = 0; - for (size_t j = 0; j < results.n_neighbors(); ++j) { - const auto id = results.index(i, j); - if (id == svs::index::vamana::concurrent::no_external_id) { - continue; - } - if (found != j) { - results.index(i, found) = id; - results.distance(i, found) = results.distance(i, j); - } - ++found; - } - found_neighbors_per_query[i] = found; - } + if (sync_kind == SVS_SYNC_KIND_FINE_GRAIN || cancel()) { + // Erased IDs (consolidation) and cancelled slots hold no_external_id. + compact_found(results, found_neighbors_per_query); } return {std::move(results), std::move(found_neighbors_per_query)}; } @@ -186,7 +203,7 @@ std::pair, std::vector> DynamicIndexVamana::sea std::max(num_neighbors, params.buffer_config_.get_search_window_size()); auto found_neighbors_per_query = filtered_topk_search( - index, results, queries, batch_hint, id_filter, sample_generator + index, results, queries, batch_hint, id_filter, sample_generator, cancel ); return {results, found_neighbors_per_query}; } @@ -281,7 +298,8 @@ std::pair, std::vector> ConcurrentIndexVamana:: svs::data::ConstSimpleDataView queries, size_t num_neighbors, const std::shared_ptr& search_params, - const IDFilterInterface* id_filter + const IDFilterInterface* id_filter, + const lib::DefaultPredicate& cancel ) { assert(sync_kind == SVS_SYNC_KIND_FINE_GRAIN); if (queries.size() > 1) { @@ -289,7 +307,9 @@ std::pair, std::vector> ConcurrentIndexVamana:: "FINE GRAIN dynamic index only supports searching one query at a time." ); } - return DynamicIndexVamana::search(queries, num_neighbors, search_params, id_filter); + return DynamicIndexVamana::search( + queries, num_neighbors, search_params, id_filter, cancel + ); } size_t ConcurrentIndexVamana::add_points( diff --git a/bindings/c/src/index_vamana.hpp b/bindings/c/src/index_vamana.hpp index 2a193981e..65888fa42 100644 --- a/bindings/c/src/index_vamana.hpp +++ b/bindings/c/src/index_vamana.hpp @@ -44,7 +44,8 @@ struct IndexVamana : public Index { svs::data::ConstSimpleDataView queries, size_t num_neighbors, const std::shared_ptr& search_params, - const IDFilterInterface* id_filter + const IDFilterInterface* id_filter, + const lib::DefaultPredicate& cancel ) override; void save(const std::filesystem::path& directory) override { @@ -93,7 +94,8 @@ struct DynamicIndexVamana : public DynamicIndex { svs::data::ConstSimpleDataView queries, size_t num_neighbors, const std::shared_ptr& search_params, - const IDFilterInterface* id_filter + const IDFilterInterface* id_filter, + const lib::DefaultPredicate& cancel ) override; void save(const std::filesystem::path& directory) override; @@ -170,7 +172,8 @@ struct ConcurrentIndexVamana : public DynamicIndexVamana { svs::data::ConstSimpleDataView queries, size_t num_neighbors, const std::shared_ptr& search_params, - const IDFilterInterface* id_filter + const IDFilterInterface* id_filter, + const lib::DefaultPredicate& cancel ) override; size_t add_points( diff --git a/bindings/c/src/svs_c.cpp b/bindings/c/src/svs_c.cpp index 5a549b3c4..28be866f6 100644 --- a/bindings/c/src/svs_c.cpp +++ b/bindings/c/src/svs_c.cpp @@ -28,6 +28,8 @@ #include "threadpool.hpp" #include "types_support.hpp" +#include +#include #include #include #include @@ -370,6 +372,21 @@ svs_search_params_create_vamana(size_t search_window_size, svs_error_h out_err) extern "C" void svs_search_params_free(svs_search_params_h params) { delete params; } +extern "C" bool svs_search_params_set_cancel_callback( + svs_search_params_h params, svs_is_cancelled_fn fn, void* userdata, svs_error_h out_err +) { + using namespace svs::c_runtime; + return wrap_exceptions( + [&]() { + EXPECT_ARG_NOT_NULL(params); + params->impl->cancel_fn = fn; + params->impl->cancel_userdata = fn == nullptr ? nullptr : userdata; + return true; + }, + out_err + ); +} + extern "C" svs_storage_h svs_storage_create_simple(svs_data_type_t data_type, svs_error_h out_err) { using namespace svs::c_runtime; @@ -1478,11 +1495,38 @@ extern "C" bool svs_index_search_topk( IDFilterAdapter id_filter_adapter(id_filter); + // Latch the first `true` so every thread stops and we can report it below. + std::atomic fired{false}; + svs::lib::DefaultPredicate cancel = svs::lib::Returns(svs::lib::Const()); + if (search_params != nullptr && search_params->impl->cancel_fn != nullptr) { + cancel = [&, + fn = search_params->impl->cancel_fn, + ud = search_params->impl->cancel_userdata]() { + if (fired.load(std::memory_order_relaxed)) { + return true; + } + if (fn(ud)) { + fired.store(true, std::memory_order_relaxed); + return true; + } + return false; + }; + } + + // Cancelled before the search starts: report no results, search nothing. + if (cancel()) { + out_results->num_queries = num_queries; + out_results->total_results = 0; + std::fill_n(out_results->offsets, num_queries + 1, size_t{0}); + throw coded_error(SVS_ERROR_CANCELLED, "Search cancelled by callback"); + } + auto [search_results, found_neighbors_per_query] = index_ptr->search( queries_view, k, search_params == nullptr ? nullptr : search_params->impl, - id_filter == nullptr ? nullptr : &id_filter_adapter + id_filter == nullptr ? nullptr : &id_filter_adapter, + cancel ); out_results->num_queries = num_queries; @@ -1503,6 +1547,9 @@ extern "C" bool svs_index_search_topk( } out_results->offsets[num_queries] = result_index; // sentinel + if (cancel()) { + throw coded_error(SVS_ERROR_CANCELLED, "Search cancelled by callback"); + } return true; }, out_err diff --git a/bindings/c/tests/c_api_index.cpp b/bindings/c/tests/c_api_index.cpp index 46fd1215c..dced37d72 100644 --- a/bindings/c/tests/c_api_index.cpp +++ b/bindings/c/tests/c_api_index.cpp @@ -25,7 +25,10 @@ // Standard library #include +#include #include +#include +#include #include CATCH_TEST_CASE("C API Index Build and Search", "[c_api][index][build][search]") { @@ -1548,3 +1551,174 @@ CATCH_TEST_CASE("C API Filtered Search topK", "[c_api][index][search][filter]") svs_error_free(error); } } + +namespace { +// Cancel callback: counts its polls and returns true from poll number `cancel_after` + 1. +struct CancelState { + std::atomic calls{0}; + size_t cancel_after = static_cast(-1); +}; + +bool cancel_after_polls(void* userdata) { + auto* state = static_cast(userdata); + return state->calls.fetch_add(1) >= state->cancel_after; +} +} // namespace + +CATCH_TEST_CASE("C API Search Cancel Callback", "[c_api][index][search][cancel]") { + const size_t NUM_VECTORS = 1000; + const size_t NUM_QUERIES = 5; + const size_t DIMENSION = 32; + const size_t K = 10; + const size_t INVALID_ID = static_cast(-1); + + // Random data: the periodic generate_test_data() pattern has duplicate vectors, which + // starves a filtered search. + std::mt19937 rng(1); + std::uniform_real_distribution uniform(-1.0f, 1.0f); + std::vector data(NUM_VECTORS * DIMENSION); + std::vector queries(NUM_QUERIES * DIMENSION); + for (auto& x : data) { + x = uniform(rng); + } + for (auto& x : queries) { + x = uniform(rng); + } + + svs_error_h error = svs_error_create(); + svs_algorithm_h algorithm = svs_algorithm_create_vamana(16, 32, 100, error); + svs_index_builder_h builder = svs_index_builder_create( + SVS_DISTANCE_METRIC_EUCLIDEAN, DIMENSION, algorithm, error + ); + CATCH_REQUIRE( + svs_index_builder_set_threadpool(builder, SVS_THREADPOOL_KIND_NATIVE, 4, error) + ); + svs_search_params_h params = svs_search_params_create_vamana(100, error); + svs_id_filter_interface_ops odd_ops = + SVS_INIT_ID_FILTER_OPS(filter_is_odd, filter_rate_odd); + svs_id_filter_interface odd_filter = SVS_MAKE_INTERFACE(nullptr, odd_ops); + + // Runs the cancel checks on `index`; `live(id)` says whether `id` may be returned. + auto check = [&](svs_index_h index, svs_id_filter_i filter, auto live) { + auto search = [&](svs_search_results_t* results) { + return svs_index_search_topk( + index, queries.data(), NUM_QUERIES, K, results, params, filter, error + ); + }; + auto set_callback = [&](CancelState* state) { + CATCH_REQUIRE(svs_search_params_set_cancel_callback( + params, state ? cancel_after_polls : nullptr, state, error + )); + }; + + svs_search_results_t expected = SVS_INIT_SEARCH_RESULTS(); + CATCH_REQUIRE(search(&expected)); + CATCH_REQUIRE(expected.total_results > 0); + + // A callback that never fires, or no callback, gives the same results. + CancelState never; + for (CancelState* state : {&never, static_cast(nullptr)}) { + set_callback(state); + svs_search_results_t results = SVS_INIT_SEARCH_RESULTS(); + CATCH_REQUIRE(search(&results)); + CATCH_REQUIRE(results.total_results == expected.total_results); + for (size_t i = 0; i < expected.total_results; ++i) { + CATCH_REQUIRE(results.indices[i] == expected.indices[i]); + CATCH_REQUIRE(results.distances[i] == expected.distances[i]); + } + svs_search_results_free(&results); + } + CATCH_REQUIRE(never.calls.load() > 0); + + // Cancelled before the search starts: no results. + CancelState always; + always.cancel_after = 0; + set_callback(&always); + svs_search_results_t results = SVS_INIT_SEARCH_RESULTS(); + CATCH_REQUIRE_FALSE(search(&results)); + CATCH_REQUIRE(svs_error_get_code(error) == SVS_ERROR_CANCELLED); + CATCH_REQUIRE(results.total_results == 0); + svs_search_results_free(&results); + + // Cancelled in the middle: only live IDs, never the invalid-neighbor marker. + CancelState mid; + mid.cancel_after = never.calls.load() / 2; + set_callback(&mid); + results = SVS_INIT_SEARCH_RESULTS(); + CATCH_REQUIRE_FALSE(search(&results)); + CATCH_REQUIRE(svs_error_get_code(error) == SVS_ERROR_CANCELLED); + CATCH_REQUIRE(results.total_results > 0); + CATCH_REQUIRE(results.offsets[NUM_QUERIES] == results.total_results); + for (size_t q = 0; q < NUM_QUERIES; ++q) { + CATCH_REQUIRE(results.offsets[q + 1] - results.offsets[q] <= K); + } + for (size_t i = 0; i < results.total_results; ++i) { + CATCH_REQUIRE(results.indices[i] != INVALID_ID); + CATCH_REQUIRE(live(results.indices[i])); + } + svs_search_results_free(&results); + svs_search_results_free(&expected); + set_callback(nullptr); + }; + + CATCH_SECTION("Static index") { + svs_index_h index = svs_index_build(builder, data.data(), NUM_VECTORS, error); + CATCH_REQUIRE(index != nullptr); + check(index, nullptr, [&](size_t id) { return id < NUM_VECTORS; }); + svs_index_free(index); + } + + CATCH_SECTION("Static index, filtered") { + svs_index_h index = svs_index_build(builder, data.data(), NUM_VECTORS, error); + CATCH_REQUIRE(index != nullptr); + check(index, &odd_filter, [&](size_t id) { return id < NUM_VECTORS && id % 2; }); + svs_index_free(index); + } + + CATCH_SECTION("Dynamic index with deletions") { + // Row i has external ID 5000 + i; every 5th vector is deleted. + std::vector ids(NUM_VECTORS); + std::iota(ids.begin(), ids.end(), size_t{5000}); + svs_index_h index = svs_index_build_dynamic( + builder, data.data(), ids.data(), NUM_VECTORS, 1024 * 1024, error + ); + CATCH_REQUIRE(index != nullptr); + std::vector deleted; + for (size_t i = 0; i < NUM_VECTORS; i += 5) { + deleted.push_back(ids[i]); + } + CATCH_REQUIRE(svs_index_dynamic_delete_points( + index, deleted.data(), deleted.size(), nullptr, error + )); + check(index, nullptr, [&](size_t id) { + return id >= 5000 && id < 5000 + NUM_VECTORS && (id - 5000) % 5 != 0; + }); + svs_index_free(index); + } + + CATCH_SECTION("Dynamic index with deletions, filtered") { + // Row i has external ID 5000 + i; every 5th vector is deleted, odd IDs pass. + std::vector ids(NUM_VECTORS); + std::iota(ids.begin(), ids.end(), size_t{5000}); + svs_index_h index = svs_index_build_dynamic( + builder, data.data(), ids.data(), NUM_VECTORS, 1024 * 1024, error + ); + CATCH_REQUIRE(index != nullptr); + std::vector deleted; + for (size_t i = 0; i < NUM_VECTORS; i += 5) { + deleted.push_back(ids[i]); + } + CATCH_REQUIRE(svs_index_dynamic_delete_points( + index, deleted.data(), deleted.size(), nullptr, error + )); + check(index, &odd_filter, [&](size_t id) { + return id >= 5000 && id < 5000 + NUM_VECTORS && (id - 5000) % 5 != 0 && id % 2; + }); + svs_index_free(index); + } + + svs_search_params_free(params); + svs_index_builder_free(builder); + svs_algorithm_free(algorithm); + svs_error_free(error); +} diff --git a/bindings/c/tests/c_api_search_params.cpp b/bindings/c/tests/c_api_search_params.cpp index 1d3daa174..7c02d7afa 100644 --- a/bindings/c/tests/c_api_search_params.cpp +++ b/bindings/c/tests/c_api_search_params.cpp @@ -89,3 +89,24 @@ CATCH_TEST_CASE("C API Search Parameters", "[c_api][search_params]") { svs_error_free(error); } } + +CATCH_TEST_CASE( + "C API Search Cancel Callback arguments", "[c_api][search_params][cancel]" +) { + svs_error_h error = svs_error_create(); + svs_is_cancelled_fn never = [](void*) { return false; }; + + CATCH_REQUIRE_FALSE( + svs_search_params_set_cancel_callback(nullptr, never, nullptr, error) + ); + CATCH_REQUIRE(svs_error_get_code(error) == SVS_ERROR_INVALID_ARGUMENT); + + svs_search_params_h params = svs_search_params_create_vamana(100, nullptr); + CATCH_REQUIRE(params != nullptr); + // A NULL error handle is allowed, and a NULL callback removes the callback. + CATCH_REQUIRE(svs_search_params_set_cancel_callback(params, never, nullptr, nullptr)); + CATCH_REQUIRE(svs_search_params_set_cancel_callback(params, nullptr, nullptr, nullptr)); + + svs_search_params_free(params); + svs_error_free(error); +}