Skip to content

Commit b04746d

Browse files
committed
Remove deprecated SAM helpers from C++ client API.
1 parent be62387 commit b04746d

5 files changed

Lines changed: 2 additions & 97 deletions

File tree

README.md

Lines changed: 2 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@
1515

1616
### What is the hlquery C++ API?
1717

18-
The hlquery C++ API is the official C++ client for [hlquery](https://github.com/hlquery/hlquery). It wraps the server's HTTP/JSON interface in a small typed client with response helpers, auth support, SQL helpers, system helpers, and SAM support.
18+
The hlquery C++ API is the official C++ client for [hlquery](https://github.com/hlquery/hlquery). It wraps the server's HTTP/JSON interface in a small typed client with response helpers, auth support, SQL helpers, and system helpers.
1919

2020
It is intended for native services, command-line tools, and applications that want direct hlquery access without hand-rolling HTTP calls.
2121

2222
### Why use it?
2323

24-
Use the C++ client when your application already lives close to hlquery and you want the search layer to feel native instead of like a pile of hand-built HTTP calls. The library keeps request setup, auth, response parsing, and endpoint routing in one place, so application code can work with collections, documents, search, SQL, system routes, and SAM through one small client surface.
24+
Use the C++ client when your application already lives close to hlquery and you want the search layer to feel native instead of like a pile of hand-built HTTP calls. The library keeps request setup, auth, response parsing, and endpoint routing in one place, so application code can work with collections, documents, search, SQL, and system routes through one small client surface.
2525

2626
It is still close to the server API. You get typed helpers for the common paths, but the raw request helper remains available for custom module routes or newer endpoints that have not yet grown a dedicated wrapper. That makes it useful for production services that want a stable integration point without losing access to hlquery's full HTTP surface.
2727

@@ -86,27 +86,6 @@ client.setAuthToken("your_api_key_here", "api-key");
8686
client.clearAuth();
8787
```
8888
89-
### SAM
90-
91-
Use the SAM helpers to inspect indexing status and run SAM search:
92-
93-
SAM is separate from vector search. It performs term and intent-style lookup, not vector similarity search.
94-
95-
```cpp
96-
hlquery::Client client("http://localhost:9200");
97-
98-
auto sam = client.sam();
99-
auto status = sam->status("music");
100-
auto history = sam->history("music", 5);
101-
auto results = sam->search("music", "queen of pop", {
102-
{"limit", "10"}
103-
});
104-
105-
std::cout << status.getBody().dump(2) << std::endl;
106-
std::cout << history.getBody().dump(2) << std::endl;
107-
std::cout << results.getBody().dump(2) << std::endl;
108-
```
109-
11089
### System
11190
11291
Use the system helper for operational routes that were added after the initial C++ client surface:
@@ -162,4 +141,3 @@ auto response = client.executeRequest(
162141
}
163142
);
164143
```
165-

include/hlquery/client.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include "documents.h"
2121
#include "request.h"
2222
#include "response.h"
23-
#include "sam.h"
2423
#include "search.h"
2524
#include "system.h"
2625
#include "utils/Config.h"
@@ -38,7 +37,6 @@ class Client
3837
void clearAuth();
3938

4039
std::shared_ptr<System> system();
41-
std::shared_ptr<Sam> sam();
4240

4341
/* System APIs */
4442

@@ -90,9 +88,6 @@ class Client
9088
std::shared_ptr<Search> searchApi();
9189
[[deprecated("Use client.collections()->search(...) for collection-scoped searches.")]]
9290
Response search(const std::string& collection_name, const std::map<std::string, std::string>& params = {});
93-
Response samSearch(const std::string& collection_name, const std::string& query,
94-
const std::map<std::string, std::string>& params = {});
95-
Response samSearchAll(const std::string& query, const std::map<std::string, std::string>& params = {});
9691
[[deprecated("Use client.sql(collection_name, sql, ...) for collection-scoped SQL searches.")]]
9792
Response sqlSearch(const std::string& collection_name, const std::string& sql,
9893
const std::map<std::string, std::string>& params = {});
@@ -118,7 +113,6 @@ class Client
118113
std::shared_ptr<Documents> documents_;
119114
std::shared_ptr<Search> search_;
120115
std::shared_ptr<System> system_;
121-
std::shared_ptr<Sam> sam_;
122116
};
123117

124118
}

include/hlquery/search.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@ class Search
3232
Search(std::shared_ptr<Request> request, std::shared_ptr<Collections> collections);
3333

3434
Response search(const std::string& collection_name, const std::map<std::string, std::string>& params = {});
35-
Response samSearch(const std::string& collection_name, const std::string& query,
36-
const std::map<std::string, std::string>& params = {});
37-
Response samSearchAll(const std::string& query, const std::map<std::string, std::string>& params = {});
3835
Response sql(const std::string& collection_name, const std::string& sql,
3936
const std::map<std::string, std::string>& params = {});
4037
Response multiSearch(const std::vector<nlohmann::json>& searches);

src/client.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ Client::Client(const std::string& base_url, const std::map<std::string, std::str
3535
documents_ = std::make_shared<Documents>(request_);
3636
search_ = std::make_shared<Search>(request_, collections_);
3737
system_ = std::make_shared<System>(request_);
38-
sam_ = std::make_shared<Sam>(request_);
3938
}
4039

4140
void Client::setAuthToken(const std::string& token, const std::string& method)
@@ -193,11 +192,6 @@ std::shared_ptr<System> Client::system()
193192
return system_;
194193
}
195194

196-
std::shared_ptr<Sam> Client::sam()
197-
{
198-
return sam_;
199-
}
200-
201195
Response Client::listCollections(int offset, int limit)
202196
{
203197
return collections_->list(offset, limit);
@@ -248,17 +242,6 @@ Response Client::search(const std::string& collection_name, const std::map<std::
248242
return collections_->search(collection_name, params);
249243
}
250244

251-
Response Client::samSearch(const std::string& collection_name, const std::string& query,
252-
const std::map<std::string, std::string>& params)
253-
{
254-
return sam_->search(collection_name, query, params);
255-
}
256-
257-
Response Client::samSearchAll(const std::string& query, const std::map<std::string, std::string>& params)
258-
{
259-
return search_->samSearchAll(query, params);
260-
}
261-
262245
Response Client::sqlSearch(const std::string& collection_name, const std::string& sql,
263246
const std::map<std::string, std::string>& params)
264247
{

src/search.cpp

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -99,53 +99,6 @@ Response Search::search(const std::string& collection_name, const std::map<std::
9999
return request_->execute("GET", path);
100100
}
101101

102-
Response Search::samSearch(const std::string& collection_name, const std::string& query,
103-
const std::map<std::string, std::string>& params)
104-
{
105-
utils::validateCollectionName(collection_name);
106-
107-
if (query.empty())
108-
{
109-
throw std::invalid_argument("SAM query must be a non-empty string");
110-
}
111-
112-
std::map<std::string, std::string> query_params = params;
113-
query_params["collection"] = collection_name;
114-
query_params["q"] = query;
115-
116-
std::string path = "/sam/search";
117-
std::string query_string = buildQueryString(query_params);
118-
119-
if (!query_string.empty())
120-
{
121-
path += "?" + query_string;
122-
}
123-
124-
return request_->execute("GET", path);
125-
}
126-
127-
Response Search::samSearchAll(const std::string& query, const std::map<std::string, std::string>& params)
128-
{
129-
if (query.empty())
130-
{
131-
throw std::invalid_argument("SAM query must be a non-empty string");
132-
}
133-
134-
std::map<std::string, std::string> query_params = params;
135-
query_params["q"] = query;
136-
query_params["all"] = "true";
137-
138-
std::string path = "/sam/search";
139-
std::string query_string = buildQueryString(query_params);
140-
141-
if (!query_string.empty())
142-
{
143-
path += "?" + query_string;
144-
}
145-
146-
return request_->execute("GET", path);
147-
}
148-
149102
Response Search::sql(const std::string& collection_name, const std::string& sql,
150103
const std::map<std::string, std::string>& params)
151104
{

0 commit comments

Comments
 (0)