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

fix(core): support Insights in requesters #562

Merged
merged 1 commit into from
May 3, 2021

Conversation

francoischalifour
Copy link
Member

Description

In #540, we introduced the Requester API to batch Algolia queries, but we left out Insights plugin support. These metadata fields are required for the Insights plugin to send events to the API.

This PR brings support for the Insights plugin from requesters by adding back the necessary metadata in the hits returned by the Algolia API.

Related

## Description

In #540, we introduced the Requester API to batch Algolia queries, but we [left out Insights plugin support](https://github.com/algolia/autocomplete/blob/c62f1d2757c5824c5a2f456c20cf55ca3d962cdb/packages/autocomplete-preset-algolia/src/search/getAlgoliaHits.ts#L18-L19). These metadata fields are required for the Insights plugin to send events to the API.

This PR brings support for the Insights plugin from requesters by adding back the necessary metadata in the hits returned by the Algolia API.

## Related

- #559 (reply in thread)
@codesandbox-ci
Copy link

codesandbox-ci bot commented May 3, 2021

@francoischalifour francoischalifour merged commit c305ab4 into next May 3, 2021
@francoischalifour francoischalifour deleted the fix/requester-insights-support branch May 3, 2021 09:35
> = rawResults.map((result) => {
return {
...result,
hits: (result as SearchResponse<THit>).hits?.map((hit) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't see a check for sffv response here, are you relying on it being undefined?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes—we don't transform hits if it's not defined.

We don't support Insights for facet hits.

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.

3 participants