KinoSearch::Highlight::Highlighter - create and highlight excerpts |
KinoSearch::Highlight::Highlighter - create and highlight excerpts
my $highlighter = KinoSearch::Highlight::Highlighter->new( excerpt_field => 'bodytext', ); $hits->create_excerpts( highlighter => $highlighter );
KinoSearch'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.
my $highlighter = KinoSearch::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:
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 the KinoSearch::Highlight::Formatter manpage,
used to perform the actual highlighting.
encoder - an object which subclasses the KinoSearch::Highlight::Encoder manpage.
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.
Copyright 2005-2006 Marvin Humphrey
See KinoSearch version 0.15.
KinoSearch::Highlight::Highlighter - create and highlight excerpts |