Catman...DB::CQL(3pm)
π NAME π
Catmandu::Store::MongoDB::CQL β bestie, it takes a CQL query string and turns it into a MongoDB query string. That's it. That's the whole job. And it slays at it.
β¨ SYNOPSIS β¨
$mongo_query = Catmandu::Store::ElasticSearch::CQL
->new(mapping => $cql_mapping)
->parse($cql_query_string);
okay so you build one with a mapping, then you parse your CQL string. Simple. Clean. Iconic. π
πΈ DESCRIPTION πΈ
ngl this package currently parses most of CQL 1.1, and the vibes are immaculate. Here's the full list of what it knows how to handle:
andornotsrw.allRecordssrw.serverChoicesrw.anywherecql.allRecordscql.serverChoicecql.anywhere=scr<><=>=<>exactallanywithin
if you want the full lore on the CQL query language itself, the source material lives at <https://www.loc.gov/standards/sru/cql/spec.html> π
π LIMITATIONS π
okay bestie, real talk, this is the part where we need to sit down. MongoDB is not a full-text search engine. Not even close. So basically every query is gonna try to find exact matches in the database β with two exceptions, and those exceptions are any and all.
Those two relations get translated into wildcard queries, and wildcard queries are slow. Not "kinda slow." Slow slow.
So like, this:
title any 'funny cats'
gets treated internally as something like:
title : { $regex : /funny/ } OR title : { $regex : /cats/ }
And this:
title all 'funny cats'
becomes:
title : { $regex : /funny/ } AND title : { $regex : /cats/ }
π«Ά so yeah βanyandallare not as efficient (fast) as the exact matches==andexact. That's just the deal, no cap.
π METHODS π
π₯ parse
Parses the given CQL query string with CQL::Parser and converts it to a Mongo query string. It literally just does what it says. β¨
π¦ visit
Converts the given CQL::Node to a Mongo query string. Main character energy, tiny method.
π REMARKS π
- no support for fuzzy search
- no support for search modifiers
- no support for
sortBy - no support for
encloses
we simply do not do those things here π
β SEE ALSO β
CQL::Parser.
okay that's the whole page, ily, go parse something π
this was Catman...DB::CQL(3pm) β part of the perl v5.32.1 era, dated 2021-09-02, living under User Contributed Perl Documentation. bye bestie, mwah ππ
π¦ where this page comes from
- debian bookworm: libcatmandu-store-mongodb-perl 0.0806-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libcatmandu-store-mongodb-perl 0.0806-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libcatmandu-store-mongodb-perl 0.0806-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libcatmandu-store-mongodb-perl 0.0806-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libcatmandu-store-mongodb-perl 0.0806-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libcatmandu-store-mongodb-perl 0.0806-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms