- Issue created by @davidwhthomas
- Merge request !213Remove extra HTML::escape to allow highlight range to match. → (Open) created by davidwhthomas
- 🇳🇿New Zealand davidwhthomas
One of the tests fails, I'm not sure of the significance of this:
✘ Postprocess search results with complex keys ┐ ├ Excerpt was added. ├ Failed asserting that two strings are equal. ┊ ---·Expected ┊ +++·Actual ┊ @@ @@ ┊ -'…·This·foo·text·bar·will·get·baz·riddled·with·<strong>·tags.·…' ┊ +'…·This·foo·text·bar·will·get·baz·riddled·with··tags.·…' │ │ /builds/issue/search_api-3507292/tests/src/Unit/Processor/HighlightTest.php:859 ┴
- 🇦🇹Austria drunken monkey Vienna, Austria
Thanks for reporting this issue!
However, as you see by the failing test, this problem is unfortunately not that easy to fix as we do want to have our excerpts be valid HTML, which is why we need to escape the plain text version before adding the highlighting tags. Conceivably, we could also do the highlighting on the plain-text version and then escape the text right before adding the highlighting tags, but that would require larger changes to the code.For now, would you be able to add a regression test for this problem to
HighlightTest
? That way we can immediately see whether a proposed solution works as intended while also doesn’t break any existing functionality.