The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Parqus - parse a search query string

VERSION

version 0.05

SYNOPSIS

    use Parqus;
    my $parser = Parqus->new( keywords => [ qw/name title/ ] );
    my $res;

    $res = $parser->process('title:"bar baz" foo title: meh');
    # {
    #   words    => ['foo'],
    #   keywords => {
    #                 title => [
    #                            'bar baz',
    #                            'meh',
    #                          ]
    #               },
    # }

    $res = $parser->process('title:"bar baz" title: meh');
    # {
    #   keywords => {
    #                 title => [
    #                            'bar baz',
    #                            'meh',
    #                          ]
    #               },
    # }

    $res = $parser->process('foo bar baz');
    # {
    #   words => ['foo', 'bar', 'baz'],
    # }

    $res = $parser->process('tag: inactive');
    # {
    #   errors => {
    #               'Parse Error: Invalid search query.'
    #             },
    # }

DESCRIPTION

Parqus (PArse QUery String) parses a search-engine like string into a perl structure

NEW

    my $parser = Parqus->new( %options );

OPTIONS

keywords

    keywords => [ qw/name title/ ]

the list of keywords you want to recognise.

value_regex

regular expression to capture words. (default: [qr![\w-]+!xms])

string_delimiters

array of characters used to delimit strings. (default: ['"])

SEE ALSO

Regexp::Grammars, Search::Query, Search::Query::Dialect::DBIxClass

AUTHOR

David Schmidt <davewood@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2020 by David Schmidt.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.