Search::Query::Dialect - abstract base class for query language dialects
my $query = Search::Query->parser->parse('foo'); print $query;
Search::Query::Dialect is the base class from which all query dialects inherit.
A Dialect subclass must implement at least two methods:
Returns the serialized query tree.
Returns one clause of a serialized query tree.
See Search::Query::Dialect::Native for a working example.
Get/set flag.
Standard attribute accessor. Default value is undef.
DEPRECATED. Use BUILD() instead.
All subclasses must override this method. The default behavior is to croak.
Returns the query Dialect instance as a hashref structure, similar to that of Search::QueryParser.
Traverse a Dialect object, calling CODE on each Clause. The CODE reference should expect 4 arguments:
The Clause object.
The Dialect object.
The CODE reference.
The prefix ("+", "-", and "") for the Clause.
Translate from one Dialect to another. Returns an object blessed into the dialect class.
Add clause as an "or" leaf to the Dialect object.
Add clause as an "and" leaf to the Dialect object.
Add clause as a "not" leaf to the Dialect object.
Add clause as a sub clause to the Dialect object. In this case, clause should also be a Dialect object.
Should return the name of the Field class associated with the Dialect. Default is 'Search::Query::Field'.
Returns the default field for this Dialect.
Returns a Field object instance for field_name. The object will be an instance of field_class.
This is a shorthand wrapper around the method of the same name in the internal parser object.
Called by Parser in parse() before actually building the Dialect object from query_string.
This allows for any "cleaning up" or other munging of query_string to support the official Parser syntax.
The default just returns query_string untouched. Subclasses should return a parseable string.
Returns the Search::Query::Parser object that generated the Dialect object.
Peter Karman, <karman at cpan.org>
<karman at cpan.org>
Please report any bugs or feature requests to bug-search-query at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Search-Query. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-search-query at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Search::Query
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Search-Query
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Search-Query
CPAN Ratings
http://cpanratings.perl.org/d/Search-Query
Search CPAN
http://search.cpan.org/dist/Search-Query/
Copyright 2010 Peter Karman.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Search::Query, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Search::Query
CPAN shell
perl -MCPAN -e shell install Search::Query
For more information on module installation, please visit the detailed CPAN module installation guide.