Menu
Feedback
Start here
Tutorials
Developer portal

Known Issues
Support Rules
Troubleshooting

Frequently Asked Questions
Announcements
Known issues
Catalog filter API (Facets) exhibits unexpected behavior when fields of different specifications have the same name
Catalog filter API (Facets) exhibits unexpected behavior when fields of different specifications have the same name
ID:
Backlog
Published on 8/16/2017
Last update on 12/22/2022

Summary

When executing the filter API (Facet), an error 500 message ("An item with the same key has already been added") is displayed if the result contains specification fields (of product or SKU) with the same name.

API EndPoint: /api/catalog_system/pub/facets/search/{category}?map=c

Simulation

To simulate this scenario:

  1. Create a field named "size" for example in any subcategory of the category you wish to test. Define it as a filter.
  2. Create a field having the same name ("size", in our example) in another subcategory of the category you wish to test. Define it as a filter as well.
  3. Input values in these fields;
  4. Create a product in each subcategory and fill out the defined field ("size" in our example)
  5. Wait for the product indexation to finish (about 5 minutes)
  6. Execute the endpoint /api/catalog_system/pub/facets/search/{category}?map=c

Workaround

To prevent this behavior, avoid creating fields having the same name in parallel categories (subcategories of the same parent category).

If the API is used for rendering a side menu (filter), it can replaced by the native searchNavigator control. Click here to find out more

Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
Contributors
2
Photo of the contributor
Photo of the contributor
+ 2 contributors
On this page
Still got questions?
Ask the community
Find solutions and share ideas in the VTEX community.
Join our community
Request support from VTEX
For personalized assistance, contact our experts.
Open a support ticket
GithubDeveloper portalCommunityFeedback