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(specs): search w/ hits & facets responses #1774

Merged
merged 4 commits into from
Jul 28, 2023
Merged

fix(specs): search w/ hits & facets responses #1774

merged 4 commits into from
Jul 28, 2023

Conversation

aallam
Copy link
Member

@aallam aallam commented Jul 18, 2023

🧭 What and Why

Multi search endpoint support conducting both 'hits' and 'facets' search operations within the same call. Although this is already outlined in the specifications for requests, it is not yet included for responses.

Changes included:

Update the endpoint to support both 'hits' and 'facets' for requests as well as responses.

@netlify
Copy link

netlify bot commented Jul 18, 2023

Deploy Preview for api-clients-automation ready!

Name Link
🔨 Latest commit bdaf750
🔍 Latest deploy log https://app.netlify.com/sites/api-clients-automation/deploys/64c3b7c3a8325000080cb7a3
😎 Deploy Preview https://deploy-preview-1774--api-clients-automation.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@algolia-bot
Copy link
Collaborator

algolia-bot commented Jul 18, 2023

✗ The generated branch has been deleted.

If the PR has been merged, you can check the generated code on the main branch.
You can still access the code generated on main via this commit.

@aallam aallam force-pushed the fix/multi-search branch 5 times, most recently from 3b06ef2 to e77baee Compare July 24, 2023 12:28
@aallam aallam marked this pull request as ready for review July 24, 2023 13:33
@aallam aallam requested a review from a team as a code owner July 24, 2023 13:33
@aallam aallam requested review from millotp and shortcuts July 24, 2023 13:33
Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

awesome

Copy link
Member

Choose a reason for hiding this comment

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

this looks super cool as a workaround!

it's sad we can't une the discriminator field, is it because we need to specify the type?

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, indeed, the usual approach is to examine the value of the field, and from there, deduce its type. Unfortunately, we can't do that in this case. :/

Copy link
Member

Choose a reason for hiding this comment

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

what if the type was on its one and we pass it with a ref? would it be possible?

Copy link
Member Author

Choose a reason for hiding this comment

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

Can you give more detail? by pass in it with a ref, you mean in the specs ?

Copy link
Member

Choose a reason for hiding this comment

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

Yes but I guess here it's a matter of generation instead

Comment on lines +6 to +7
x-discriminator-fields:
- facetHits
Copy link
Member

Choose a reason for hiding this comment

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

considering our use of this field, can't we rely on the built-in one?

discriminator:
  propertyName: facetHits

Copy link
Member Author

@aallam aallam Jul 28, 2023

Choose a reason for hiding this comment

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

Regrettably, we can't rely on the built-in one in this context. The notion of a discriminator is to include type information within the object, such as type: SearchForFacetsResponse, but that's not present in our responses. In this case, we're checking for the existence of certain field(s), not their types. Furthermore, in anticipation of a day when proper type information will be included in the responses, it would be best to keep the semantics separate and reserve the discriminator for when the relevant fields become available.

Copy link
Member

Choose a reason for hiding this comment

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

:( oki as long as it works let's go with that and try to implement it in other clients too if possible!

the generator refactor might help with unifying all of that

Copy link
Member

@shortcuts shortcuts left a comment

Choose a reason for hiding this comment

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

awesome :D

@aallam aallam enabled auto-merge (squash) July 28, 2023 12:42
@aallam aallam merged commit 2ac508f into main Jul 28, 2023
21 checks passed
@aallam aallam deleted the fix/multi-search branch July 28, 2023 12:55
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