Scroll to navigation

Catmandu::Store::MongoDB::CQL(3pm) User Contributed Perl Documentation Catmandu::Store::MongoDB::CQL(3pm)

NAME

Catmandu::Store::MongoDB::CQL - Converts a CQL query string to a MongoDB query string

SYNOPSIS

    $mongo_query = Catmandu::Store::ElasticSearch::CQL
                    ->new(mapping => $cql_mapping)
                    ->parse($cql_query_string);

DESCRIPTION

This package currently parses most of CQL 1.1:

    and
    or
    not
    srw.allRecords
    srw.serverChoice
    srw.anywhere
    cql.allRecords
    cql.serverChoice
    cql.anywhere
    =
    scr
    <
    >
    <=
    >=
    <>
    exact
    all
    any
    within

See <https://www.loc.gov/standards/sru/cql/spec.html> for more information on the CQL query language.

LIMITATIONS

MongoDB is not a full-text search engine. All queries will try to find exact matches in the database, except for the 'any' and 'all' relations which will translate queries into wildcard queries (which are slow!):

   title any 'funny cats'

will be treated internally as something like:

    title : { $regex : /funny/ } OR title : { $regex : /cats/ }

And,

    title all 'funny cats'

as

    title : { $regex : /funny/ } AND title : { $regex : /cats/ }

This makes the 'any' and 'all' not as efficient (fast) as exact matches '==','exact'.

METHODS

parse

Parses the given CQL query string with CQL::Parser and converts it to a Mongo query string.

visit

Converts the given CQL::Node to a Mongo query string.

REMARKS

no support for fuzzy search, search modifiers, sortBy and encloses

SEE ALSO

CQL::Parser.

2021-09-02 perl v5.32.1