Do not add leading/trailing ellipses when the string is less than excerpt lenght

Created on 13 May 2025, 4 months ago

Problem/Motivation

Highlighter processor always wraps the generated excerpt between ellipses, even if the original string's length than the configured excerpt max length.

Steps to reproduce

Excerpt length: 256

Original value: Routes a private network through a Cloudflare Tunnel.
Generated excerpt: … Routes a private network through a Cloudflare Tunnel. …

Proposed resolution

Only wrap the string when it was truncated and/or extracted from the context of a longer string.

Remaining tasks

🐛 Bug report
Status

Active

Version

1.0

Component

General code

Created by

🇭🇺Hungary mxr576 Hungary

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @mxr576
  • 🇭🇺Hungary mxr576 Hungary
  • 🇦🇹Austria drunken monkey Vienna, Austria

    Thanks for reporting this issue.
    However, I see this a bit differently. To me, the ellipses not only suggest that text was actually truncated, but also that the field value from which the snippet was taken is not the only text on the entire entity. Which is nearly always the case.
    I’m open to hearing others’ opinions on this, though, I certainly don’t have a strong opinion either way. Also, if you think it’s not that uncommon to have just a single text value for a result item then we can certainly think about removing the ellipses (if appropriate) in this case – at least if it doesn’t complicate the code too much.

Production build 0.71.5 2024