feat(search): highlight search result terms

Signed-off-by: Phil Kuang <pkuang@factset.com>
This commit is contained in:
Phil Kuang
2022-04-20 00:05:52 -04:00
parent 894f4022b6
commit 3a74e203a8
42 changed files with 947 additions and 69 deletions
+25
View File
@@ -28,12 +28,37 @@ export interface SearchQuery {
pageCursor?: string;
}
/**
* @beta
* Metadata for result relevant document fields with matched terms highlighted
* via wrapping in associated pre/post tags. The UI is expected to parse these
* field excerpts by replacing wrapping tags with applicable UI elements for rendering.
*/
export interface ResultHighlight {
/**
* Prefix tag for wrapping terms to be highlighted.
*/
preTag: string;
/**
* Postfix tag for wrapping terms to be highlighted.
*/
postTag: string;
fields: {
/**
* Matched document fields and associated excerpts containing highlighted
* terms wrapped in preTag and postTag to be parsed and rendered in the UI.
*/
[field: string]: string;
};
}
/**
* @beta
*/
export interface Result<TDocument extends SearchDocument> {
type: string;
document: TDocument;
highlight?: ResultHighlight;
}
/**