Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(types): introduce generic Hit type #1191

Merged
merged 4 commits into from
Sep 8, 2020
Merged

Conversation

francoischalifour
Copy link
Member

@francoischalifour francoischalifour commented Sep 8, 2020

This introduces a new generic Hit type that infers values for records' highlighting and snippeting results.

@francoischalifour francoischalifour requested review from Haroenv and a team September 8, 2020 15:24
@ghost ghost requested review from yannickcr and removed request for a team September 8, 2020 15:24
Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, but I think you used it in too many places, getObject(s) & browse don't have highlighting


export type MultipleQueriesResponse<TObject> = {
/**
* The list of results.
*/
results: Array<SearchResponse<TObject & ObjectWithObjectID>>;
results: Array<SearchResponse<TObject>>;
Copy link
Member Author

@francoischalifour francoischalifour Sep 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We used it pass ObjectWithObjectID here but it was already taken care of in SearchResponse, so we had it passed twice. This was not an issue since this type is just adding objectID another time.

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks very good!

In the future I'd love to play with attributesToRetrieve & attributesToHighlight deciding which keys get responded, although I'm not sure if you can get all of that statically (since it could be a setting)

@francoischalifour francoischalifour merged commit 919d3ab into master Sep 8, 2020
@francoischalifour francoischalifour deleted the feat/Hit-type branch September 8, 2020 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants