Catmandu::Store::MongoDB::CQL - Converts a CQL query string to a MongoDB query
string
$mongo_query = Catmandu::Store::ElasticSearch::CQL
->new(mapping => $cql_mapping)
->parse($cql_query_string);
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.
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'.
Parses the given CQL query string with CQL::Parser and converts it to a Mongo
query string.
Converts the given CQL::Node to a Mongo query string.
no support for fuzzy search, search modifiers, sortBy and encloses
CQL::Parser.