SearchResult class getters #
aggregations #
Returns a JSON string representing the search aggregations.
Arguments #
char const* aggregations() const;
fetched #
Returns the number retrieved items so far.
Arguments #
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 #
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 #
unsigned total() const;
scroll_id #
Returns the identifier to the next page of result.
Arguments #
char const* scroll_id() const;
Usage #
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;
}
Edit this page on Github(opens new window)