LibreCat / Catmandu-Store-Elasticsearch

https://metacpan.org/release/Catmandu-Store-Elasticsearch
6 stars 5 forks source link

_parse_term_node not only returns query, but also modifies it in place #31

Closed nicolasfranck closed 2 months ago

nicolasfranck commented 4 months ago

A CQL query like cql.allRecords is now translated into {} (empty hash).

Reason: line https://github.com/LibreCat/Catmandu-Store-Elasticsearch/blob/main/lib/Catmandu/Store/ElasticSearch/CQL.pm#L39 expects the methods to modify the provided $query inline (it ignores return values), but https://github.com/LibreCat/Catmandu-Store-Elasticsearch/blob/main/lib/Catmandu/Store/ElasticSearch/CQL.pm#L83 returns only the new query, instead of also modifying it.

Test:

my $bag = Catmandu->store("search")->bag("publication");
my $es_query = $bag->translate_cql_query('cql.allRecords');