UNPKG

kuzzle-sdk

Version:
54 lines (53 loc) 1.58 kB
import { BaseRequest, JSONObject } from "../../types"; import { RequestPayload } from "../../types/RequestPayload"; import { Kuzzle } from "../../Kuzzle"; export interface SearchResult<T> { /** * Search aggregations */ aggregations?: JSONObject; /** * Page results */ hits: Array<T>; /** * Total number of items that can be retrieved */ total: number; /** * Number of retrieved items so far */ fetched: number; /** * Advances through the search results and returns the next page of items. * * @see https://docs.kuzzle.io/sdk/js/7/core-classes/search-result/next/ * * @example * while (result) { * // process result.hits here * result = await result.next(); * } * * @returns A SearchResult or null if no more pages */ next(): Promise<SearchResult<T> | null>; } export declare class SearchResultBase<T> implements SearchResult<T> { protected _searchAction: string; protected _scrollAction: string; protected _controller: string; protected _request: RequestPayload; protected _kuzzle: Kuzzle; protected _options: JSONObject; protected _result: JSONObject; aggregations?: JSONObject; suggest: JSONObject; hits: Array<T>; total: number; fetched: number; constructor(kuzzle: Kuzzle, request: BaseRequest, options?: JSONObject, result?: any); next(): Promise<SearchResult<T> | null>; protected _get(object: any, path: any): any; protected _buildNextSearchResult(result: any): any; }