KinoSearch1::Highlight::Highlighter(3pm)

KinoSearch1::Highlight::Highlighter3pm

Create and highlight excerpts

Usage

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

Overview

KinoSearch1's Highlighter can be used to select a relevant snippet from a document, and to surround search terms with highlighting tags. It handles both stems and phrases correctly and efficiently, using special-purpose data generated at index-time.

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
    );

Constructor. Takes hash-style parameters:

•

excerpt_field - the name of the field from which to draw the excerpt. This field must be "vectorized".

•

excerpt_length - the length of the excerpt, in bytes. This should probably use characters as a unit instead of bytes, and the behavior is likely to change in the future.

•

formatter - an object which subclasses KinoSearch1::Highlight::Formatter, used to perform the actual highlighting.

•

encoder - an object which subclasses KinoSearch1::Highlight::Encoder. All excerpt text gets passed through the encoder, including highlighted terms. By default, this is a SimpleHTMLEncoder, which encodes HTML entities.

•

pre_tag - deprecated.

•

post_tag - deprecated.

LICENSE, DISCLAIMER, BUGS, etc.

See KinoSearch1 version 1.01.

Releases

8 releases since Debian 6.0 (Squeeze); the text changed 7 times.

  1. 6.0
  2. 7
  3. 8
  4. 9
  5. 10
  6. 11
  7. 12
  8. 13

From libkinosearch1-perl 1.01-6+b1 in Debian 13 (Trixie). Parsed by carta from the page's man source.