Create your groups in Merchandising Studio
Create and manage compositions and composition rules in Merchandising Studio. The HTTP APIs, API clients, and Algolia dashboard don’t support these tasks. Creating groups involves two procedures: creating a composition and creating its rules.Create a composition
Compositions help you compose dynamic result feeds with more control.1
Open the composition creator
Go to the Merchandising Studio and open the Merch tools page.
Select the Search all compositions and indices menu and click + Create Composition.

2
Configure the composition
In the New Composition menu, enter a name for this dynamic results , and an optional description.
Select which main should be associated with this results feed.
Create one composition per index.
If you have different sites, for example, for different geographical regions,
create one composition per site and index,
such as “Product results feed - US”.
Each composition can have rules for the insertion of groups.
If you have five sites and one product index each, you need five compositions.
Give each composition a short, descriptive, and unique name, and select its main source index.After creating your first composition,
you can find it in the Search all compositions and indices menu.
To list all your compositions and create new ones,
go to the Compositions section in the sidebar and click All Compositions.

Create composition rules
To insert a curated group of results for a specific query, category page, or collection, define and publish a composition rule.1
Open Composition Rules
Use the Index and Compositions selector to select the relevant composition.
Go to the Merchandising Studio’s Merch tools > Compositions > Composition Rules page.
Besides Merch tools, you can use Merchandising Studio’s Visual Merchandiser
to manage both composition and index rules in a single visual workflow.
Go to Visual Merchandiser, select the relevant composition,
, category, or collection, then click Actions.
2
Create a composition rule
Click New Composition Rule.
3
Configure group placement
In the compositions rules editor, configure where to insert your groups given specific conditions,
and based on which filters match the group results.
4
Specify the trigger conditions
Specify the conditions for triggering your composition rule, for example, search queries, categories, collections and contexts.
You can select several queries, categories, and collections if you want to inject the same groups for them.

5
Add groups
Add the groups you would like to create. Select Algolia Index as the data source, then use filters with ‘and’ as well as ‘or’ operations to curate the items that should appear in the group. Specify the group’s starting position in the results, as well as the number of matching to include.
To add a group from a collection, on the

_collections attribute.6
Save the composition rule
Save the group and then the composition rule to apply it.If not enough records match the filter criteria, a group might have fewer items than you specified.
The included records can vary at query-time, based on their real-time attribute values as well as applied ranking criteria and index-level rules.
Curate groups
You can curate groups further, that is, change the behavior of the query used to retrieve and rank the group’s items, by applying Index Rules to it (for example, for a group with promoted Adidas items, the group’s sub-query might be query=“shoes” and filter: “brand”=“Adidas”). For more information, see Composition rules and index rules. For example, you can pin, hide, or boost items within the group:- Go to Merchandising Studio’s Visual Merchandiser.
- Select the corresponding Composition and Search query/Category/Collection where the group’s Composition Rule is applied.
- Click Actions > Curate “group name” (or find the group in the visual preview, click the three dots, then select “Curate group”).
- The Index Rule Visual Editor will open, allowing you to define Consequences (for example pin or hide items) for the group’s sub-query.
- Publish the Index Rule.
Integrate compositions
Integrating compositions and smart groups involves these steps:1
Copy your API credentials
In the Algolia dashboard,
go to Settings > API Keys and copy your and .
The API key needs at least search permissions for the index used in your composition.
2
Copy the composition ID
In Merchandising Studio, go to Merch tools > Compositions > Composition Rules and select the composition from the Composition or Index selector.
Copy the composition ID to your clipboard.

3
Choose an integration method
Query the Composition API with API clients or InstantSearch for web.
Integrate compositions with API clients
Use the Composition API client in one of the supported programming languages.Integrate compositions with InstantSearch
Start by replacing the Search API client with the Composition API client. Compositions require these versions of the InstantSearch libraries:- React InstantSearch: version 7.15.5 or later
- InstantSearch.js: version 4.78.1 or later
- Vue InstantSearch: version 4.20.6 or later
- The Shopify, Magento, and BigCommerce frontend integrations and the default Salesforce B2C Commerce frontend integration aren’t supported.
- You can’t use the
indexwidget. - You can’t combine Composition API calls with Search API or Recommend API calls on the same page.
- You can’t show groups in autocomplete menus, but you can open a composition-based search results page from there.
Facets (including disjunctive faceting)
Disjunctive faceting lets users combine values of the same withOR.
For example, users can filter the brand facet by Nike or Adidas.
When querying the Composition API, add the disjunctive modifier to a facet to return accurate values and counts while that facet is filtered.
For example:
JavaScript
InstantSearch handles this automatically.
Events setup
When sending click and conversion events, you still need to send the underlying index name asindexName attribute with your events,
not the composition ID.
No further changes are needed.
InstantSearch’s events tracking mechanism handles passing the underlying index name for you,
if you’re using the specified versions of the packages.
Next steps
Curate group results
Curate group results
Use index rules with composition rules to curate group results.
For details, see Composition rules and index rules.
Dynamic Re-Ranking
Dynamic Re-Ranking
When enabled on your index, Dynamic Re-Ranking re-ranks both main results and results in groups.
Groups and sorting
Groups and sorting
You can set up a composition for your replica index.
Then, you can curate the replica feed like a standard results feed.
Place multiple groups
Place multiple groups
Each group needs a unique start position.
If group ranges overlap, Algolia shifts the group with the higher start position to the next available positions.For example, group A has three products starting at position 1, and group B has three starting at position 2.
The final order is A.1, A.2, A.3, B.1, B.2, B.3, followed by the main results at position 7.
Deduplication
Deduplication
Algolia removes duplicates across and groups.
By default, the
highestInjected strategy keeps the item in its group position instead of in organic results.To choose different behavior, configure the deduplication strategy in the composition rule.