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(queryRuleContext): allow to make refinements based on query #4638

Merged
merged 2 commits into from
Feb 5, 2021

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Feb 3, 2021

Summary

this use case came up in a support ticket, they wanted to add a query rule when the query did not match something. The engine only has positive matches, so negative matches need to be done frontend.

Result

Before that use case was implemented like this: https://codesandbox.io/s/dynamically-deactivate-rule-forked-wouf8?file=/src/app.js

With this PR it can be implemented like this: https://codesandbox.io/s/dynamically-deactivate-rule-forked-h9w20?file=/src/app.js

(still a bit longer than I wanted, but that's because you can't transform inside trackedFilters, and enabling it would be a breaking change)

this use case came up in a support ticket, they wanted to add a query rule when the query _did not_ match something. The engine only has positive matches, so negative matches need to be done frontend.

Right now I implemented it like this: https://codesandbox.io/s/dynamically-deactivate-rule-forked-wouf8?file=/src/app.js but it would be nicer using trackedFilters as they should be used: (link pending)
@codesandbox-ci
Copy link

codesandbox-ci bot commented Feb 3, 2021

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 01135ec:

Sandbox Source
InstantSearch.js Configuration
Dynamically deactivate rule (forked) PR

@Haroenv Haroenv marked this pull request as ready for review February 3, 2021 13:31
@Haroenv Haroenv requested review from francoischalifour, a team and eunjae-lee and removed request for a team February 3, 2021 13:31
Copy link
Contributor

@eunjae-lee eunjae-lee 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 to me!

@Haroenv Haroenv merged commit dd033fc into master Feb 5, 2021
@Haroenv Haroenv deleted the feat/rule-filters-query branch February 5, 2021 14:32
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