App Search Bug with snippet highlighting and closing parenthesis

Hello! We are running into a small, but annoying bug with App Search. We have a number of document titles that end with a closing parenthesis. We display the highlighted snippet, but the ending parenthesis is getting cutoff in the snippet, as shown in this example image.

app_search_parens_bug

What version of App Search are you using?

FWIW, this is a known issue, and it's related to some underlying issues in Elasticsearch's highlighter.

I'm not sure whether or not this was resolved on the latest Elasticsearch, which is why I asked about what version you are using.

For what it is worth, here is a related thread from our search-ui library, where I describe how I've worked around this in the past on some front-end implementations: Some fields are cut before ")" · Issue #475 · elastic/search-ui · GitHub.

Another way you could work around this is to turn snippet "fallback" off for that field. You could then show the "snippet" if it exists, or use the "raw" field if it does not exist. The raw field does not have this problem.

One big word of caution, the "raw" field it NOT escaped, so make sure to handle the raw field as text, not as html, as you would likely do with the snippet field.

Thanks, Jason! We are using the latest version 7.12. We will try using the fallback=false option and raw field.