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(disjunctive): prefer values of main query for facet count #6445

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Nov 20, 2024

Summary

Use the values of the main facet in disjunctive facets

This is relevant in two cases:

  • second query is non-exhaustive
  • second query is not correct due to facet count after distinct

There's still more edge cases left (first query non exhaustive, but second isn't, but that's unlikely) and those are not worse after this PR.

Result

disjunctive facets read the count from the first query over the ones from the second query. This is already the case for hierarchical facets.

This is relevant in two cases:
- second query is non-exhaustive
- second query is not correct due to facet count after distinct

There's still more edge cases left (first query non exhaustive, but second isn't, but that's unlikely) and those are not worse after this PR.
Copy link

codesandbox-ci bot commented Nov 20, 2024

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit c4e91f9:

Sandbox Source
example-instantsearch-getting-started Configuration
example-react-instantsearch-getting-started Configuration
example-react-instantsearch-next-app-dir-example Configuration
example-react-instantsearch-next-routing-example Configuration
example-vue-instantsearch-getting-started Configuration

@Haroenv Haroenv marked this pull request as ready for review November 20, 2024 16:43
@Haroenv Haroenv requested review from a team, dhayab and shaejaz and removed request for a team November 20, 2024 16:44
@Haroenv Haroenv added the 🚨 DO NOT MERGE for a pull request that is ready to review, but should not be merged yet label Nov 20, 2024
Copy link
Member

@dhayab dhayab left a comment

Choose a reason for hiding this comment

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

This works great for disjunctive refinements. Looking at the customer issue again, they experience this on a conjunctive refinement, which is not covered by this fix. Do you want to handle this in a subsequent PR or can you add it here?

@Haroenv
Copy link
Contributor Author

Haroenv commented Nov 21, 2024

How could they have this issue on a conjunctive facet? there's only one query there

@dhayab
Copy link
Member

dhayab commented Nov 21, 2024

Sorry I was wrong, I thought the menu widget was using conjunctive faceting but it instead is based on hierarchical facets. In that case, we do reattribute the root level count but not in this instance?

screenshot-20241121-102734@2x

@Haroenv Haroenv requested a review from dhayab November 22, 2024 08:46
@Haroenv
Copy link
Contributor Author

Haroenv commented Nov 22, 2024

@dhayab fixed now for hierarchical too, but only if persistHierarchicalRootCount is true, other cases seemed to break a lot of tests

@dhayab
Copy link
Member

dhayab commented Nov 22, 2024

Nice, thanks!

Copy link
Member

@dhayab dhayab left a comment

Choose a reason for hiding this comment

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

This works, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚨 DO NOT MERGE for a pull request that is ready to review, but should not be merged yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants