Add a rank attribute to the Result type.

Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
Eric Peterson
2022-06-09 15:11:24 +02:00
parent cd1acab463
commit 484afdf1dc
3 changed files with 24 additions and 3 deletions
+18
View File
@@ -56,9 +56,27 @@ export interface ResultHighlight {
* @public
*/
export interface Result<TDocument extends SearchDocument> {
/**
* The "type" of the given document. See: {@link DocumentCollatorFactory."type"}
*/
type: string;
/**
* The raw value of the document, as indexed.
*/
document: TDocument;
/**
* Optional result highlight. Useful for improving the search result
* display/experience.
*/
highlight?: ResultHighlight;
/**
* Optional result rank, where 1 is the first/top result returned. Useful for
* understanding search effectiveness in analytics.
*/
rank?: number;
}
/**