
Search::Tools - high-performance tools for building search applications

use Search::Tools;
my $string = 'the quik brown fox';
my $qparser = Search::Tools->parser();
my $query = $qparser->parse($string);
my $snipper = Search::Tools->snipper(query => $query);
my $hiliter = Search::Tools->hiliter(query => $query);
my $spellcheck = Search::Tools->spellcheck(query_parser => $qparser);
my $suggestions = $spellcheck->suggest($string);
for my $s (@$suggestions) {
if (! $s->{suggestions}) {
# $s->{word} was spelled correctly
}
elsif (@{ $s->{suggestions} }) {
printf "Did you mean: %s\n", join(' or ', @{$s->{suggestions}}));
}
}
for my $result (@search_results) {
print $hiliter->light( $snipper->snip( $result->summary ) );
}

Search::Tools is a set of utilities for building search applications. Rather than adhering to a particular search application or framework, the goal of Search::Tools is to provide general-purpose methods for common search application features. Think of Search::Tools like a toolbox rather than a hammer.
Examples include:
Search::Tools is derived from some of the features in HTML::HiLiter and SWISH::HiLiter, but has been re-written with an eye to accomodating more general purpose features.

Returns a Search::Tools::Parser object, passing args to new().
Deprecated. Use parser() instead.
Returns a Search::Tools::HiLiter object, passing args to new().
Returns a Search::Tools::Snipper object, passing args to new().
Same as:
Search::Tools::Transliterate->new()->convert( $str )
Returns a Search::Tools::SpellCheck object, passing args to new().
Reads contents of filename into a scalar variable. Similar to File::Slurp, but will handle compressed files (.gz or .bz2) transparently using IO::Uncompress.

XS debugging help. Same as using Devel::Peek.

Perl 5.8.3 or later is required. This is for full UTF-8 support.
The following CPAN modules are required:
The following CPAN modules are recommended for the full set of features and for performance.
See also the specific module documentation for individual requirements.

The public API has changed as of version 0.24. The following classes are now removed:
Search::Tools::Keywords Search::Tools::RegExp Search::Tools::RegExp::Keywords Search::Tools::RegExp::Keyword
The following Search::Tools method is deprecated:
regexp()
The following classes are new as of version 0.24:
Search::Tools::HeatMap Search::Tools::Query Search::Tools::QueryParser Search::Tools::RegEx Search::Tools::Token Search::Tools::TokenList Search::Tools::TokenListPP Search::Tools::TokenListUtils Search::Tools::TokenPP Search::Tools::Tokenizer

See the tests in t/ and the example scripts in example/.

Peter Karman <karman@cpan.org>

The original idea and regular expression builder comes from HTML::HiLiter by the same author, copyright 2004 by Cray Inc.
Thanks to Atomic Learning www.atomiclearning.com for sponsoring the development of some of these modules.

Please report any bugs or feature requests to bug-search-tools at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Search-Tools. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

You can find documentation for this module with the perldoc command.
perldoc Search::Tools
You can also look for information at:

Copyright 2006-2009 by Peter Karman.
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

HTML::HiLiter, SWISH::HiLiter, Rose::Object, Class::XSAccessor, Text::Aspell