-
-
19 Aug 2006 06:34:01 UTC
- Distribution: KinoSearch
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (5)
- Testers (1 / 0 / 0)
- Kwalitee
Bus factor: 0- License: perl_5
- Activity
24 month- Tools
- Download (212.29KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
and 1 contributors- Marvin Humphrey <marvin at rectangular dot com>
- Dependencies
- Clone
- Compress::Zlib
- Lingua::Stem::Snowball
- Lingua::StopWords
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
NAME
KinoSearch::Highlight::Highlighter - create and highlight excerpts
SYNOPSIS
my $highlighter = KinoSearch::Highlight::Highlighter->new( excerpt_field => 'bodytext', ); $hits->create_excerpts( highlighter => $highlighter );
DESCRIPTION
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.
METHODS
new
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:
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 KinoSearch::Highlight::Formatter, used to perform the actual highlighting.
encoder - an object which subclasses KinoSearch::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.
COPYRIGHT
Copyright 2005-2006 Marvin Humphrey
LICENSE, DISCLAIMER, BUGS, etc.
See KinoSearch version 0.13.
Module Install Instructions
To install KinoSearch, copy and paste the appropriate command in to your terminal.
cpanm KinoSearch
perl -MCPAN -e shell install KinoSearch
For more information on module installation, please visit the detailed CPAN module installation guide.