Peter Karman > Search-Tools-0.93 > Search::Tools

Download:
Search-Tools-0.93.tar.gz

Dependencies

Annotate this POD

Website

CPAN RT

Open  0
View/Report Bugs
Module Version: 0.93   Source   Latest Release: Search-Tools-1.001

NAME ^

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

SYNOPSIS ^

 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 ) );
 }

DESCRIPTION ^

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.

METHODS ^

parser( args )

Returns a Search::Tools::Parser object, passing args to new().

regexp

Deprecated. Use parser() instead.

hiliter( args )

Returns a Search::Tools::HiLiter object, passing args to new().

snipper( args )

Returns a Search::Tools::Snipper object, passing args to new().

transliterate( str )

Same as:

 Search::Tools::Transliterate->new()->convert( $str )

spellcheck( args )

Returns a Search::Tools::SpellCheck object, passing args to new().

slurp( filename )

Reads contents of filename into a scalar variable. Similar to File::Slurp, but will handle compressed files (.gz or .bz2) transparently using IO::Uncompress.

FUNCTIONS ^

describe( object )

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

REQUIREMENTS ^

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

The following CPAN modules are required:

Rose::Object
Search::QueryParser
Data::Dump
File::Slurp
Encode
Carp

The following CPAN modules are recommended for the full set of features and for performance.

Text::Aspell
Class::XSAccessor

See also the specific module documentation for individual requirements.

HISTORY ^

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

EXAMPLES ^

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

AUTHOR ^

Peter Karman <karman@cpan.org>

ACKNOWLEDGMENTS ^

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.

BUGS ^

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.

SUPPORT ^

You can find documentation for this module with the perldoc command.

    perldoc Search::Tools

You can also look for information at:

COPYRIGHT ^

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.

SEE ALSO ^

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

syntax highlighting: