Draft
Conversation
…and tests" Agent-Logs-Url: https://github.com/developmentseed/cql2-rs/sessions/8d7a2de7-b706-4814-a840-5620aaf56589 Co-authored-by: bitner <164828+bitner@users.noreply.github.com>
…ifferentiate temporal operators Agent-Logs-Url: https://github.com/developmentseed/cql2-rs/sessions/8d7a2de7-b706-4814-a840-5620aaf56589 Co-authored-by: bitner <164828+bitner@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
bitner
April 8, 2026 15:24
View session
bitner
requested changes
Apr 8, 2026
Contributor
bitner
left a comment
There was a problem hiding this comment.
Make sure there are tests
Agent-Logs-Url: https://github.com/developmentseed/cql2-rs/sessions/6ded0974-e903-40f3-a5ac-68e0588b481c Co-authored-by: bitner <164828+bitner@users.noreply.github.com>
Author
There are 45 unit tests in
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the ability to convert a CQL2 search expression into Elasticsearch Query DSL JSON, addressing the feature request to "add the ability to convert a CQL2 search into Elasticsearch DSL".
Changes
New:
ToElasticsearchtrait (src/elasticsearch.rs)A new
ToElasticsearchtrait with ato_elasticsearch() -> Result<serde_json::Value, Error>method, implemented forExpr. It covers:AND,OR,NOT=,<>,>,>=,<,<=IS NULLLIKE(converts%→*,_→?; supportscaseiwrapper viacase_insensitive: true)IN→termsqueryBETWEEN→rangequeryS_INTERSECTS,S_WITHIN,S_CONTAINS,S_DISJOINT,S_EQUALS(bidirectional within+contains),S_TOUCHES/S_OVERLAPS/S_CROSSES(approximated as intersects)T_BEFORE,T_AFTER,T_MEETS,T_METBY,T_DURING,T_CONTAINS,T_STARTS,T_STARTEDBY,T_FINISHES,T_FINISHEDBY,T_OVERLAPS,T_OVERLAPPEDBY,T_EQUALS,T_DISJOINT,T_INTERSECTS,ANYINTERACTSThe property field may be on either side of binary predicates. Both
Expr::BBoxand theExpr::Operation { op: "bbox" }(from CQL2 text) forms are supported for spatial queries, converted to Elasticsearchenvelopeshapes.Updated:
src/lib.rsToElasticsearchfrom the crate root.Updated:
cli/src/lib.rs--output-format elasticsearchand--output-format elasticsearch-prettyCLI options.Examples
Testing
src/elasticsearch.rscovering all supported operators.tests/elasticsearch_tests.rsfollowing the project's fixture-based pattern (same structure asreduce_tests.rs), with 18 fixture pairs intests/elasticsearch_expected.txtcovering comparisons, boolean operators, LIKE, IN, BETWEEN, IS NULL, and temporal operators.