Skip to content

Commit 4aa8f79

Browse files
committed
Add searchAll aliases for global cross-collection search.
1 parent 1c67a23 commit 4aa8f79

5 files changed

Lines changed: 33 additions & 0 deletions

File tree

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,15 @@ We welcome contributions from the community! All contributions must be released
167167
- Test and report bugs against the C++ client
168168
- Improve C++-specific documentation and examples
169169

170+
### Search all collections
171+
172+
```cpp
173+
auto result = client.searchAll({{"q", "research"}, {"limit", "20"}});
174+
auto selected = client.searchAll({{"q", "research"}, {"collections", "universities,science"}});
175+
```
176+
177+
`globalSearch` remains available as an equivalent name. Results are globally merged and each hit includes `document._collection`.
178+
170179
### Community
171180
172181
- 📖 [Documentation](https://docs.hlquery.com)

include/hlquery/client.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ class Client
148148
MultiSearchResult multiSearchStructured(const std::vector<nlohmann::json>& searches);
149149
Response globalSearch(const std::map<std::string, std::string>& params = {});
150150
Response globalSearchPost(const nlohmann::json& body);
151+
Response searchAll(const std::map<std::string, std::string>& params = {});
152+
Response searchAllPost(const nlohmann::json& body);
151153

152154
/* Execute arbitrary request */
153155

include/hlquery/search.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class Search
3939
Response multiSearch(const std::map<std::string, std::string>& params);
4040
Response globalSearch(const std::map<std::string, std::string>& params = {});
4141
Response globalSearchPost(const nlohmann::json& body);
42+
Response searchAll(const std::map<std::string, std::string>& params = {});
43+
Response searchAllPost(const nlohmann::json& body);
4244
Response vectorSearch(const std::string& collection_name, const std::map<std::string, std::string>& params = {});
4345
Response vectorSearchPost(const std::string& collection_name, const nlohmann::json& body);
4446

src/client.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,16 @@ Response Client::globalSearchPost(const nlohmann::json& body)
519519
return search_->globalSearchPost(body);
520520
}
521521

522+
Response Client::searchAll(const std::map<std::string, std::string>& params)
523+
{
524+
return search_->searchAll(params);
525+
}
526+
527+
Response Client::searchAllPost(const nlohmann::json& body)
528+
{
529+
return search_->searchAllPost(body);
530+
}
531+
522532
Response Client::executeRequest(const std::string& method, const std::string& path,
523533
const nlohmann::json& body, const std::map<std::string, std::string>& query_params)
524534
{

src/search.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,16 @@ Response Search::globalSearchPost(const nlohmann::json& body)
168168
return request_->execute("POST", "/search", body);
169169
}
170170

171+
Response Search::searchAll(const std::map<std::string, std::string>& params)
172+
{
173+
return globalSearch(params);
174+
}
175+
176+
Response Search::searchAllPost(const nlohmann::json& body)
177+
{
178+
return globalSearchPost(body);
179+
}
180+
171181
Response Search::vectorSearch(const std::string& collection_name, const std::map<std::string, std::string>& params)
172182
{
173183
utils::validateCollectionName(collection_name);

0 commit comments

Comments
 (0)