New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Highlight of hierarchical fields not working #6021
Comments
Hi, you'll need to set the root level of your hierarchical attribute in <InstantSearch>
<Configure attributesToHighlight={['metadata']} /> {/* This can also be done in the Dashboard */}
<Hits hitComponent={HitComponent} />
</InstantSearch>
// ...
function HitComponent({ hit }) {
return <div>
<Highlight attribute="metadata.publisher" hit={hit} />
</div>;
} |
Thanks a lot for the hint, but I'm a bit confused, mainly because of not understanding the difference between using search_settings and the Configuration-Component and how their setting relate to each other. While configuring SearchKit I'm providing the highlight_attributes, which looks as follows:
If I provide there only 'metadata' in 'highlight_attributes', the _highlightResult will be:
However, the Highlight-Component seems not to be able to deal with "[object Object]", so it remains empty not matter of adding Configuration or not. Instead, when using your code, _highlightResult again looks like
but the Highlight-Component still receives no value. |
It's possible SearchKit doesn't generate and return the highlighted results the same way Algolia does for nested attributes. You would have to check with them in that instance. |
馃悰 Current behavior
According to the documentation, using the highlight component for hierarchical fields should work for the following example hit:
as follows:
Instead, the highlight component is not rendered at all. Instead, if I change the attribute key as follows:
the following works:
馃攳 Steps to reproduce
Live reproduction
馃挱 Expected behavior
Well, that's easy. I would expect the highlighting also to work for hierarchical attributes.
Package version
react-instantsearch 7.5.3
Operating system
No response
Browser
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: