The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Search::Query::Dialect - query dialect base class

SYNOPSIS

 my $query = Search::Query->parser->parse('foo');
 print $query;

DESCRIPTION

Search::Query::Dialect is the base class from which all query dialects inherit.

A Dialect subclass must implement at least two methods:

stringify

Returns the serialized query tree.

stringify_clause( leaf )

Returns one clause of a serialized query tree.

See Search::Query::Dialect::Native for a working example.

METHODS

This class is a subclass of Rose::ObjectX::CAF. Only new or overridden methods are documented here.

stringify

All subclasses must override this method. The default behavior is to croak.

tree

Returns the query Dialect instance as a hashref structure, similar to that of Search::QueryParser.

walk( CODE )

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.

add_or_clause( clause )

Add clause as an "or" leaf to the Dialect object.

add_and_clause( clause )

Add clause as an "and" leaf to the Dialect object.

add_not_clause( clause )

Add clause as a "not" leaf to the Dialect object.

AUTHOR

Peter Karman, <karman at cpan.org>

BUGS

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.

SUPPORT

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

    perldoc Search::Query

You can also look for information at:

COPYRIGHT & LICENSE

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.