Compare commits

...

4 Commits

Author SHA1 Message Date
Yaniv Kaul
9aa21e3d1e Apply suggested fix to vector_search/vector_store_client.cc from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-02-16 15:50:16 +02:00
Yaniv Kaul
c6d9bf931d Apply suggested fix to vector_search/vector_store_client.cc from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-02-16 15:50:16 +02:00
Yaniv Kaul
b0a1eea14b Apply suggested fix to vector_search/vector_store_client.cc from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-02-16 15:50:15 +02:00
Yaniv Kaul
21cc04dac9 Apply suggested fix to vector_search/vector_store_client.cc from Copilot Autofix
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-02-16 15:50:15 +02:00

View File

@@ -57,11 +57,14 @@ using primary_keys = vector_search::vector_store_client::primary_keys;
using service_reply_format_error = vector_search::vector_store_client::service_reply_format_error;
using uri = vector_search::uri;
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
logging::logger vslogger("vector_store_client");
static thread_local auto random_engine = std::default_random_engine(std::random_device{}());
static thread_local std::default_random_engine& get_random_engine() {
static thread_local std::default_random_engine engine{std::random_device{}()};
return engine;
}
auto parse_port(std::string const& port_txt) -> std::optional<port_number> {
auto port = port_number{};
auto [ptr, ec] = std::from_chars(&*port_txt.begin(), &*port_txt.end(), port);
@@ -179,7 +182,7 @@ auto read_ann_json(rjson::value const& json, schema_ptr const& schema) -> std::e
}
keys.push_back(primary_key{dht::decorate_key(*schema, *pk), *ck});
}
return std::move(keys);
return keys;
}
bool should_vector_store_service_be_disabled(std::vector<sstring> const& uris) {
@@ -308,7 +311,7 @@ struct vector_store_client::impl {
}
auto path = format("/api/v1/indexes/{}/{}/ann", keyspace, name);
auto content = write_ann_json(std::move(vs_vector), limit, filter);
auto content = write_ann_json(vs_vector, limit, filter);
auto resp = co_await request(operation_type::POST, std::move(path), std::move(content), as);
if (!resp) {
@@ -320,9 +323,11 @@ struct vector_store_client::impl {
}
if (resp->status != status_type::ok) {
vslogger.error("Vector Store returned error: HTTP status {}: {}", resp->status, seastar::value_of([&resp] {
return response_content_to_sstring(resp->content);
}));
if (vslogger.is_enabled(log_level::error)) {
vslogger.error("Vector Store returned error: HTTP status {}: {}", resp->status, seastar::value_of([&resp] {
return response_content_to_sstring(resp->content);
}));
}
co_return std::unexpected{service_error{resp->status}};
}