AppSearch, SearchUI - best practise hide/delete/sanitize html tags in text type

Hello, what's best practice to hide or delete html tags for the best search experience with search ui?

For example I have a content field with content like:

<p>Hello world</p><code> get this whatever https:.....</code>

When I use the snippet function, all html tags appear in the results. Thats not what I want.
And the raw function sounds not the best too
So, how I can sanitize this?
Should I do this before indexing to appsearch or is it possible to do it later?

On the new relic docs page ( ) I saw, they use also the search ui library of elastic. But they did it right: there aren't html or markup tags in the search result.

Thanks for better solutions...

Data in the snippet field is always safe to use, it is already sanitized. Always prefer to use that over the raw field.

I think the safest and most efficient way to handle this would be to filter the html tags out before you index the content.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.