NAME
Apache::Wyrd::Services::SearchParser
SYNOPSIS
use Apache::Wyrd::Services::SearchParser;
sub key {'key'};
sub search {
.....
}
my $parser = Apache::Wyrd::Services::SearchParser->new($self);
return $parser->parse('(search AND word) OR (web NOT page)');
DESCRIPTION
Allows for logical parsing of a search using AND, OR, NOT and DIFF keywords. Designed to work with Apache::Wyrd::Services::Index
, but can work with another search object. Note that these keywords MUST be in upper-case to parse, otherwise they will be interpreted as the literal words.
Any search object using the parser should implement a search()
method which does a word search against an index, returning an array of hashes.
METHODS
(format: (returns) name (arguments after self))
- (Apache::Wyrd::Services::SearchParser)
new
(objectref) -
Create a new parser object. The search object using the parser should pass itself as the argument, as
parse
will call it'ssearch
andkey
methods. - (array)
parse
(scalar, array) -
Parse accepts a phrase to parse for searching and an array which it will transparently pass to the
search
method of the calling object. Returns an array of results derived from recursively callingsearch
and joining the results based on the logical operators.
BUGS/CAVEATS
UNKNOWN
AUTHOR
Barry King <wyrd@nospam.wyrdwright.com>
SEE ALSO
LICENSE
Copyright 2002-2004 Wyrdwright, Inc. and licensed under the GNU GPL.
See LICENSE under the documentation for Apache::Wyrd
.