Skip to content

Conversation

@francoischalifour
Copy link
Contributor

@francoischalifour francoischalifour commented Mar 14, 2019

This is the 3rd PR in the series "Merchandized Query Rules".

Summary

This headless widget sets the rule contexts (called ruleContexts) of the search parameters based on the filters.

Query rules are by default generic when not provided any context. If you provide a context, they become contextual and are only triggered when the context is matched.

Usage

instantsearch.widgets.queryRuleContext({
  container,
  trackedFilters: {
    genre: () => ['Thriller', 'Drama'],
  },
});

This will set the following ruleContexts dynamically:

  • ais-genre-Thriller
  • ais-genre-Drama

API

trackedFilters

object – no default

The filters to track to add rule contexts.

transformRuleContexts

string[] ⇒ string[] – defaults to identity function

The function to apply to the rule contexts before sending them to Algolia.

Stories

See stories →

Related

@francoischalifour francoischalifour requested a review from a team March 14, 2019 12:38
@francoischalifour francoischalifour force-pushed the feat/mqr-queryRuleCustomData branch from e3f8f79 to 01dac7f Compare March 14, 2019 12:40
@algobot
Copy link
Contributor

algobot commented Mar 14, 2019

Deploy preview for instantsearchjs ready!

Built with commit 6b29675

https://deploy-preview-3602--instantsearchjs.netlify.com

@francoischalifour francoischalifour force-pushed the feat/mqr-queryRuleContext branch from 298bafe to debad1d Compare March 14, 2019 12:43
@francoischalifour francoischalifour force-pushed the feat/mqr-queryRuleCustomData branch from 01dac7f to 6add930 Compare March 14, 2019 13:50
@francoischalifour francoischalifour force-pushed the feat/mqr-queryRuleContext branch from debad1d to 6d0ba46 Compare March 14, 2019 13:51
@francoischalifour
Copy link
Contributor Author

This feature is on hold – see #3597 (comment).

@francoischalifour
Copy link
Contributor Author

⬆️ I rebased against #3617 with the workaround for setting the context and other search parameters in a single request. You can check the story.

@francoischalifour francoischalifour force-pushed the feat/mqr-connectQueryRules-context branch from 4ef4f25 to cce2bc1 Compare March 25, 2019 13:24
@francoischalifour francoischalifour force-pushed the feat/mqr-queryRuleContext branch from 1ef28a4 to 8dc2b2e Compare March 25, 2019 14:37
@francoischalifour francoischalifour force-pushed the feat/mqr-queryRuleContext branch from 8dc2b2e to 6b29675 Compare March 26, 2019 09:06
@francoischalifour francoischalifour merged commit bd60bed into feat/mqr-connectQueryRules-context Mar 28, 2019
@francoischalifour francoischalifour deleted the feat/mqr-queryRuleContext branch March 28, 2019 12:07
francoischalifour added a commit that referenced this pull request Apr 1, 2019
* feat(queryRules): add context features to connectQueryRules
* feat(queryRules): add queryRuleContext widget (#3602)
francoischalifour added a commit that referenced this pull request Apr 11, 2019
# [3.3.0](v3.2.1...v3.3.0) (2019-04-11)

### Bug Fixes

* **connectQueryRules:** improve tracked refinement type ([#3648](#3648)) ([e16ad57](e16ad57))
* **currentRefinements:** don't rely on  ([#3672](#3672)) ([cd64bcf](cd64bcf))
* **queryRuleCustomData:** add default template ([#3650](#3650)) ([83e9eaa](83e9eaa))
* **QueryRuleCustomData:** pass data as object to templates ([#3647](#3647)) ([b8f8b4e](b8f8b4e))
* **queryRules:** fix types and stories ([#3670](#3670)) ([ba6e2e6](ba6e2e6))
* **routing:** apply windowTitle on first load ([#3669](#3669)) ([d553502](d553502)), closes [#3667](#3667)
* **routing:** support parsing URLs with up to 100 refinements ([#3671](#3671)) ([6ddcfb6](6ddcfb6))
* **RoutingManager:** avoid stale uiState ([#3630](#3630)) ([e1588aa](e1588aa))
* **types:** improve InstantSearch types ([#3651](#3651)) ([db9b91e](db9b91e))
* **ua:** Update the User-Agent to use the new format ([#3616](#3616)) ([ab84c57](ab84c57))

### Features

* **infiniteHits:** add previous button ([#3645](#3645)) ([2c9e38d](2c9e38d))
* **queryRules:** add connectQueryRules connector ([#3597](#3597)) ([924cd99](924cd99)), closes [#3599](#3599) [#3600](#3600)
* **queryRules:** add context features to Query Rules ([#3617](#3617)) ([922879e](922879e)), closes [#3602](#3602)

### Reverts

* feat(infiniteHits): add previous button ([214c0fc](214c0fc))
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.

5 participants