Skip to content

Commit

Permalink
feat(client-search): add personalization field to RankingInfo (#1213)
Browse files Browse the repository at this point in the history
* refactor(client-search): extract and expose RankingInfo type

* feat(client-search): add personalization field to RankingInfo
  • Loading branch information
kombucha authored Sep 29, 2020
1 parent 94bfb75 commit 50b78a3
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions packages/client-search/src/types/Hit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,26 +22,33 @@ export type SnippetResult<THit> = THit extends string | number
[KAttribute in keyof THit]: SnippetResult<THit[KAttribute]>;
};

export type RankingInfo = {
readonly promoted: boolean;
readonly nbTypos: number;
readonly firstMatchedWord: number;
readonly proximityDistance?: number;
readonly geoDistance: number;
readonly geoPrecision?: number;
readonly nbExactWords: number;
readonly words: number;
readonly filters: number;
readonly userScore: number;
readonly matchedGeoLocation?: {
readonly lat: number;
readonly lng: number;
readonly distance: number;
};
readonly personalization?: {
readonly filtersScore: number;
readonly rankingScore: number;
readonly score: number;
};
};

export type Hit<THit> = THit & {
readonly objectID: string;
readonly _highlightResult?: HighlightResult<THit>;
readonly _snippetResult?: SnippetResult<THit>;
readonly _rankingInfo?: {
readonly promoted: boolean;
readonly nbTypos: number;
readonly firstMatchedWord: number;
readonly proximityDistance?: number;
readonly geoDistance: number;
readonly geoPrecision?: number;
readonly nbExactWords: number;
readonly words: number;
readonly filters: number;
readonly userScore: number;
readonly matchedGeoLocation?: {
readonly lat: number;
readonly lng: number;
readonly distance: number;
};
};
readonly _rankingInfo?: RankingInfo;
readonly _distinctSeqID?: number;
};

0 comments on commit 50b78a3

Please sign in to comment.