04 Apr 2006 06:54:55 UTC
- Development release
- Distribution: KinoSearch
- Source (raw)
- Browse (raw)
- How to Contribute
- Issues (5)
- Testers (1 / 1 / 0)
- KwaliteeBus factor: 0
- License: perl_5
- Activity24 month
- Download (186.36KB)
- MetaCPAN Explorer
- Subscribe to distribution
- This version
- Latest versionCREAMYG Marvin Humphreyand 1 contributors
- Marvin Humphrey <marvin at rectangular dot com>
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.