Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

feat(facets): when * is present, only send that parameter #874

Merged
merged 8 commits into from Oct 8, 2021

Conversation

Haroenv
Copy link
Contributor

@Haroenv Haroenv commented Oct 6, 2021

When * is present in facets, we don't need to request the individual facet values of each facet that's declared, as * will already request it.

We keep only * if it is present. If no * is present, the facets stay as-is.

see: algolia/instantsearch#5723

Alternatively to this PR, similar logic could be part of the algoliasearch client cache, but that has as downside that it requires an update to the search client, also custom implementations and older clients

@Haroenv
Copy link
Contributor Author

Haroenv commented Oct 6, 2021

Upon reflection, I realised that the behaviour with - isn't needed, that's for attributesToRetrieve, not facets

src/requestBuilder.js Outdated Show resolved Hide resolved
@Haroenv Haroenv requested a review from tkrugg October 7, 2021 13:33
When * is present in facets, we don't need to request the individual facet values of each facet that's declared, as * will already request it.

With a new parameter "expandWildcardFacets", we filter out all facets that aren't * itself or -something. The new parameter doesn't add "*" automatically, it still

To decide:
- is "-something" worth caring about?
- when * isn't present, should no facets be requested or the default ones?
- is this the right location, maybe the client cache should have similar logic instead?

see: https://github.com/algolia/algoliasearch-helper-js/issues/391
src/requestBuilder.js Outdated Show resolved Hide resolved
@Haroenv Haroenv changed the title feat(facets): add expandWildcardFacets parameter to process * in facets feat(facets): when * is present, only send that parameter Oct 7, 2021
test/spec/requestBuilder.js Outdated Show resolved Hide resolved
Co-authored-by: François Chalifour <francoischalifour@users.noreply.github.com>
@Haroenv Haroenv merged commit fc183ec into develop Oct 8, 2021
@Haroenv Haroenv deleted the feat/wildcard-facets branch October 8, 2021 08:38
Haroenv added a commit that referenced this pull request Oct 8, 2021
 * ci(circle): update node image (#875) 3648463
 * feat(facets): when * is present, only send that parameter (#874) fc183ec
Haroenv added a commit to algolia/instantsearch that referenced this pull request Oct 8, 2021
dhayab pushed a commit to algolia/instantsearch that referenced this pull request Jul 10, 2023
…goliasearch-helper-js#874)

* feat(facets): add expandWildcardFacets parameter to process * in facets

When * is present in facets, we don't need to request the individual facet values of each facet that's declared, as * will already request it.

With a new parameter "expandWildcardFacets", we filter out all facets that aren't * itself or -something. The new parameter doesn't add "*" automatically, it still

To decide:
- is "-something" worth caring about?
- when * isn't present, should no facets be requested or the default ones?
- is this the right location, maybe the client cache should have similar logic instead?

see: https://github.com/algolia/algoliasearch-helper-js/issues/391

* remove reference to non-existing -

* don't inject *

* rephrase

* remove the parameter, by default!

* Update src/requestBuilder.js

* fix

* Update test/spec/requestBuilder.js

Co-authored-by: François Chalifour <francoischalifour@users.noreply.github.com>

Co-authored-by: François Chalifour <francoischalifour@users.noreply.github.com>
dhayab pushed a commit to algolia/instantsearch that referenced this pull request Jul 10, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants