-
Notifications
You must be signed in to change notification settings - Fork 531
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(caching): sort filters and queries #5764
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- facetFilters - disjunctive queries sorted alphabetically through facet name This basically will allow a better cache hit rate. To figure out: - does this have a perf impact (likely not) - should it be an option - how do we ensure everything is sorted - are the right facet values read (no actually, it should be done in getRefinedDisjunctiveFacets etc.
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 f7d7c3b:
|
much slower, the default sort works just fine (the values are search parameter keys, so english) follow up on algolia/algoliasearch-helper-js#911
dhayab
reviewed
Jul 20, 2023
packages/algoliasearch-helper/test/spec/hierarchical-facets/with-a-disjunctive-facet.js
Show resolved
Hide resolved
dhayab
approved these changes
Jul 21, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
sarahdayan
approved these changes
Jul 21, 2023
Haroenv
added a commit
that referenced
this pull request
Jan 17, 2024
introduced in #5764, but wasn't an issue until merge/setQueryParameters doesn't make a new copy constantly of the parameters. Essentially what's going on: - when you build the requests, it's sorting the facet values - this then gets updated in the parameters as well as it's the same object - with this fix, the sorting is done non-mutating (similar to .toSorted) to avoid the sorting of the parameters for cache to have a potential impact on the UI
dhayab
pushed a commit
that referenced
this pull request
Jan 18, 2024
…6007) introduced in #5764, but wasn't an issue until merge/setQueryParameters doesn't make a new copy constantly of the parameters. Essentially what's going on: - when you build the requests, it's sorting the facet values - this then gets updated in the parameters as well as it's the same object - with this fix, the sorting is done non-mutating (similar to .toSorted) to avoid the sorting of the parameters for cache to have a potential impact on the UI
dhayab
pushed a commit
that referenced
this pull request
Jan 18, 2024
* fix(perf): improve speed of setQueryParameters inside setQueryParameters (used in many cases), we have _parseNumbers, which is always used with the arguments of setQueryParameters or new SearchParameters TODO: find out why CurrentRefinements > RefinementList changes its order with this change. Not sure yet * fix(requestBuilder): sort facet refinements in a non-mutating manner (#6007) introduced in #5764, but wasn't an issue until merge/setQueryParameters doesn't make a new copy constantly of the parameters. Essentially what's going on: - when you build the requests, it's sorting the facet values - this then gets updated in the parameters as well as it's the same object - with this fix, the sorting is done non-mutating (similar to .toSorted) to avoid the sorting of the parameters for cache to have a potential impact on the UI
dhayab
added a commit
that referenced
this pull request
Jan 22, 2024
…6012) introduced in #5764, but wasn't an issue until merge/setQueryParameters doesn't make a new copy constantly of the parameters. Essentially what's going on: - when you build the requests, it's sorting the facet values - this then gets updated in the parameters as well as it's the same object - with this fix, the sorting is done non-mutating (similar to .toSorted) to avoid the sorting of the parameters for cache to have a potential impact on the UI Co-authored-by: Haroen Viaene <hello@haroen.me>
dhayab
added a commit
that referenced
this pull request
Jan 22, 2024
…6012) introduced in #5764, but wasn't an issue until merge/setQueryParameters doesn't make a new copy constantly of the parameters. Essentially what's going on: - when you build the requests, it's sorting the facet values - this then gets updated in the parameters as well as it's the same object - with this fix, the sorting is done non-mutating (similar to .toSorted) to avoid the sorting of the parameters for cache to have a potential impact on the UI Co-authored-by: Haroen Viaene <hello@haroen.me>
dhayab
added a commit
that referenced
this pull request
Jan 22, 2024
…6012) introduced in #5764, but wasn't an issue until merge/setQueryParameters doesn't make a new copy constantly of the parameters. Essentially what's going on: - when you build the requests, it's sorting the facet values - this then gets updated in the parameters as well as it's the same object - with this fix, the sorting is done non-mutating (similar to .toSorted) to avoid the sorting of the parameters for cache to have a potential impact on the UI Co-authored-by: Haroen Viaene <hello@haroen.me>
dhayab
added a commit
that referenced
this pull request
Jan 22, 2024
…6012) introduced in #5764, but wasn't an issue until merge/setQueryParameters doesn't make a new copy constantly of the parameters. Essentially what's going on: - when you build the requests, it's sorting the facet values - this then gets updated in the parameters as well as it's the same object - with this fix, the sorting is done non-mutating (similar to .toSorted) to avoid the sorting of the parameters for cache to have a potential impact on the UI Co-authored-by: Haroen Viaene <hello@haroen.me>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This allows a better cache hit rate, because when widgets mount and unmount, it's possible that while the filters are the same, they are requested in a different order.
This PR fixes that on two approaches:
fixes CR-3813