AEM/CQ5 search - hit.excerpt throws errors
When using the search API, sometimes if you call hit.excerpt(), you see errors get thrown in the logs and the output to the screen includes parts of html elements. For example, the output might include literal as below:
handbook.pdf']); href="https://forums.adobe.com/longpathgoeshere/file.pdf"
I can't find the source to check, but my guess is that the excerpt code looks at properties of content nodes, finds the matching text in that node, and then grabs some amount of text on either side of the item that was found, which might land it in the middle of an html tag, so it can't cleanly remove the tag. Just guessing.
Is this a known issue, and is there a work-around for this?
I'm on 5.6.0
Thanks,
David