NAME

Search::Tools - tools for building search applications

SYNOPSIS

use Search::Tools;

my $re = Search::Tools->regexp(query => 'the quick brown fox');

my $snipper = Search::Tools->snipper(query => $re);

my $hiliter = Search::Tools->hiliter(query => $re);

for my $result (@search_results)
{
   print $hiliter->light( $snipper->snip( $result->summary ) );
}

DESCRIPTION

Search::Tools is a set of utilities for building search applications. Rather than adhering to a particular search application, 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:

  • Parsing search queries for the meaningful keywords

  • Rich regular expressions for locating keywords in the original indexed documents

  • Contextual snippets showing query keywords

  • Highlighting of keywords in context

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.

REQUIREMENTS

Perl 5.8 or later is required. This is for full UTF-8 support.

The following CPAN modules are required:

Class::Accessor::Fast
Search::QueryParser

See also the specific module documentation for individual requirements.

METHODS

transliterate( text )

See Search::Tools::Transliterate convert().

The following convenience methods are simple class methods around the indicated module. Each of them requires a query key/value pair parameter.

regexp

snipper

hiliter

COMMON ACCESSORS

The following common accessors are inherited by every module in Search::Tools:

stopwords
wildcard
word_characters
ignore_first_char
ignore_last_char
stemmer
phrase_delim
debug

See each module's documentation for more details.

AUTHOR

Peter Karman perl@peknet.com

Based on the HTML::HiLiter regular expression building code, originally by the same author, copyright 2004 by Cray Inc.

Thanks to Atomic Learning www.atomiclearning.com for sponsoring the development of these modules.

COPYRIGHT

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

SEE ALSO

HTML::HiLiter, SWISH::HiLiter, Search::Tools::Keywords, Search::Tools::RegExp, Search::Tools::RegExp::Keywords, Search::Tools::RegExp::Keyword, Search::Tools::Snipper, Search::Tools::HiLiter