KinoSe...lighter(3pm)

πŸ’– NAME πŸ’–

KinoSearch1::Highlight::Highlighter β€” bestie, it makes excerpts and then highlights them ✨

(Also hi, this page lives in the 3pm section of the manual β€” user contributed perl docs, iykyk πŸ’…)


πŸŽ€ SYNOPSIS πŸŽ€

okay so first you build a highlighter, then you let it cook:

my $highlighter = KinoSearch1::Highlight::Highlighter->new(
    excerpt_field  => 'bodytext',
);
$hits->create_excerpts( highlighter => $highlighter );

🌸 DESCRIPTION 🌸

So the Highlighter in KinoSearch1 has one job and it EATS: it picks a relevant little snippet out of a document, and then it wraps your search terms in highlighting tags. 🫢

And the way it handles both stems and phrases? Correctly. Efficiently. Both. It uses special-purpose data that got generated back at index-time, so it's not out here guessing β€” it's giving prepared, main character energy πŸ‘‘


✨ METHODS ✨

πŸ’… new

my $highlighter = KinoSearch1::Highlight::Highlighter->new(
    excerpt_field  => 'bodytext', # required
    excerpt_length => 150,        # default: 200
    formatter      => $formatter, # default: SimpleHTMLFormatter
    encoder        => $encoder,   # default: SimpleHTMLEncoder
);

The constructor 🧚 it takes hash-style parameters, which is to say, named args:

  • excerpt_field β€” the name of the field you're pulling the excerpt from. Lowkey important: this field must be "vectorized". No vector, no excerpt, periodt.
  • excerpt_length β€” how long the excerpt is, measured in bytes. And ngl, this should probably be measured in characters instead of bytes, and the behavior is likely to change in the future. So don't get too attached πŸ”₯
  • formatter β€” an object that subclasses KinoSearch1::Highlight::Formatter. It's the one doing the actual highlighting. Defaults to SimpleHTMLFormatter.
  • encoder β€” an object that subclasses KinoSearch1::Highlight::Encoder. All excerpt text gets passed through the encoder, including the highlighted terms. Default is a SimpleHTMLEncoder, which encodes HTML entities ✨
  • pre_tag β€” deprecated πŸ’€
  • post_tag β€” deprecated πŸ’€
Heads up bestie: pre_tag and post_tag are deprecated. Don't build your whole vibe on them.

Copyright 2005-2010 Marvin Humphrey


🌈 LICENSE, DISCLAIMER, BUGS, etc. 🌈

See KinoSearch1 version 1.01.


And that's the whole page, bestie β€” no skips, no summaries, we ate πŸ“

Perl v5.42.3, dated 2026-08-20, from the KinoSe...lighter(3pm) page. Mwah πŸ’–

πŸ“¦ where this page comes from