Add a rank attribute to the Result type.
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-search-common': patch
|
||||
---
|
||||
|
||||
Added an optional `rank` attribute to the `Result` type. This represents the result rank (starting at 1) for a given result in a result set for a given search.
|
||||
@@ -52,11 +52,9 @@ export type QueryTranslator = (query: SearchQuery) => unknown;
|
||||
|
||||
// @public (undocumented)
|
||||
export interface Result<TDocument extends SearchDocument> {
|
||||
// (undocumented)
|
||||
document: TDocument;
|
||||
// (undocumented)
|
||||
highlight?: ResultHighlight;
|
||||
// (undocumented)
|
||||
rank?: number;
|
||||
type: string;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user