Apache::Wyrd::Services::SearchParser - Object for performing logical word-searches
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)');
Allows for logical parsing of a search using AND, OR, NOT and DIFF keywords. 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 a reverse-key index, returning an array of hashes.
search()
Designed to work with Apache::Wyrd::Services::Index, but can work with another search object as long as the search object returns arrays of hash items with unique IDs under the ID hash key. This ID hash key defaults to 'id', which is the default key for an Apache::Wyrd::Services::Index object. If your object uses a different ID key, it should return the (scalar) name of this ID key when it's key() method is called.
Apache::Wyrd::Services::Index
key()
(format: (returns) name (arguments after self))
new
Create a new parser object. The search object using the parser should pass a reference to itself as the argument, as parse will call it's search and key methods.
parse
search
key
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 calling search and joining the results based on the logical operators.
UNKNOWN
Barry King <wyrd@nospam.wyrdwright.com>
General-purpose HTML-embeddable perl object
Copyright 2002-2007 Wyrdwright, Inc. and licensed under the GNU GPL.
See LICENSE under the documentation for Apache::Wyrd.
Apache::Wyrd
To install Apache::Wyrd, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache::Wyrd
CPAN shell
perl -MCPAN -e shell install Apache::Wyrd
For more information on module installation, please visit the detailed CPAN module installation guide.