NAME
Search::Tools::Query - objectified string for highlighting, snipping, etc.
SYNOPSIS
use Search::Tools::QueryParser;
my $qparser = Search::Tools::QueryParser->new;
my $query = $qparser->parse(q(the quick color:brown "fox jumped"));
my $terms = $query->terms; # ['quick', 'brown', '"fox jumped"']
my $regex = $query->regex_for($terms->[0]); # S::T::RegEx
my $tree = $query->tree; # the Search::QueryParser-parsed struct
print "$query\n"; # the quick color:brown "fox jumped"
print $query->str . "\n"; # same thing
DESCRIPTION
METHODS
terms
Array ref of key words from the original query string. See Search::Tools::QueryParser for controls over ignore_fields() and tokenizing regex.
NOTE: Only positive words are extracted by QueryParser. In other words, if you search for:
foo not bar
then only foo
is returned. Likewise:
+foo -bar
would return only foo
.
search_queryparser
The Search::QueryParser object used to parse the original string.
str
The original string.
regex
The hash ref of terms to Search::Tools::RegEx objects.
qp
The Search::Tools::QueryParser object used to generate the Query.
from_regexp_keywords( RegExp_Keywords_object )
Class method for easing backwards compatability with the pre-0.24 API.
num_terms
Returns the number of terms().
tree
Returns the Search::QueryParser->parse() of the original query str().
str_clean
Returns the Search::QueryParser->unparse() of tree().
regex_for(term)
Returns a Search::Tools::RegEx object for term.
regexp_for
Alias for regex_for(). The author has come to prefer "regex" instead of "regexp" because it's one less keystroke.
terms_as_regex
Returns all terms() as a single qr// regex, pipe-joined in a "OR" logic.
AUTHOR
Peter Karman <karman@cpan.org>
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:
RT: CPAN's request tracker
AnnoCPAN: Annotated CPAN documentation
CPAN Ratings
Search CPAN
COPYRIGHT
Copyright 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
Search::QueryParser