SDK
SDK C++ v1.x
1

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

This SDK has been deprecated because of stability issues. It is not advised to use it in a production environment.

SearchResult class getters #

aggregations #

Returns a JSON string representing the search aggregations.

Arguments #

Copied to clipboard!
char const* aggregations() const;

fetched #

Returns the number retrieved items so far.

Arguments #

Copied to clipboard!
unsigned fetched() const;

hits #

Returns a JSON string representing an array of JSON objects containing the matching documents.
Each object has the following properties:

Property Type Description
_id
string
Document ID
_score
number
Relevance score
_source
object
Document content

Arguments #

Copied to clipboard!
char const* hits() const;

total #

Returns the total number of found documents. Can be greater than the number of documents retrieved by the current SearchResult instance.

Arguments #

Copied to clipboard!
unsigned total() const;

scroll_id #

Returns the identifier to the next page of result.

Arguments #

Copied to clipboard!
char const* scroll_id() const;

Usage #

Copied to clipboard!
try {
  std::shared_ptr<kuzzleio::SearchResult> results = kuzzle->document->search(
    "nyc-open-data",
    "yellow-taxi",
    R"({
      "query": {
        "match": {
          "category": "suv"
        }
      }
    })");
  size_t total_documents = results->total();
  size_t fetched_documents = results->fetched();
  std::string aggregations = results->aggregations();
  std::string hits = results->hits();
  std::string scroll_id = results->scroll_id();
  std::cout << "Snippet success" << std::endl;
} catch (kuzzleio::KuzzleException& e) {
  std::cerr << e.what() << std::endl;
}