Conversation
|
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. |
|
How do you set this custom label? are you calling normalizeRefinement yourself? Have you tried using |
|
At the moment I do use the transformItems yes. But what I am trying to change happens before this. With facets, if I understand it correctly the response returned to InstantSearch should look like this: In here there is only the possibility to pass the value and count, not a different name to be shown on the page. For now i have a workaround for this by returning a response with facets that look like this: But InstantSearch then puts the count and label in the count. I can then use the transformItems to extract the count and label from the count, but this feels wrong. |
|
Yes, the right solution would indeed be something where the label is already part of the response, however as Algolia doesn't have this feature, I don't think we'll immediately add support for this pattern. The most reasonable workaround would be a mapping you save somewhere that stores the link between a facet value and its label, so that you can use it in transformItems of currentRefinements and refinementList. |
c1fa2e8 to
9af869e
Compare
I am relatively new to working with Algolia and am integrating it with my backend. During this process, I encountered an issue: I often have facets with specific values, but I want to display different names for these values on the frontend. Currently, this functionality is not supported by Algolia.
Proposed Solution:
Extend the existing label functionality to allow setting a custom label for any facet value.
Currently, the label is only used for numeric values. This proposal suggests enabling custom labels for all facet values if provided.
I believe this enhancement would be beneficial for many users who need more flexibility in displaying facet names.