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 pre_tag => '*', # default: '<strong>' post_tag => '*', # default: '</strong>', );
Constructor. Takes hash-style parameters:
excerpt_field - the name of the field from which to draw the excerpt. This field must be
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.
pre_tag - a string which will be inserted immediately prior to any keyword in the excerpt, typically to accentuate it. If you don't want highlighting, set both
post_tag - a string which will be inserted immediately after any keyword in the excerpt.
Copyright 2005-2006 Marvin Humphrey
See KinoSearch version 0.09.