Generally, we don't recommend storing HTML in Algolia records, as this would open you up to XSS vulnerabilities. To avoid this, you have two options for escaping or stripping dangerous characters: doing it before indexing, or when displaying results.
- Example of HTML data indexed in Algolia with soft hyphens and unable to search these records correctly:
If there is an issue with the HTML indexed in Algolia, you should always check the raw JSON of the record to see if there was any additional data indexed that's not visible in the record details data on the dashboard. In order to check what's happening with this specific record you can click on the Edit Record button at the bottom right corner in order to check the record raw JSON. For this example we can see that the record contains some soft hyphens, which are not visible in the record details and therefore searching the query below won't return this record:
Since soft hyphens are not being sanitized by Algolia and Algolia doesn’t sanitize your data and returns it as is, you need to manage sanitization yourself. Please read this guide here for more information on this topic.