Skip to content

Conversation

@jremmurd
Copy link
Contributor

Shorthand addCondition() for boolean fields in OpenSearch or ElasticSearch currently result in an error, as the boolean value gets auto converted to string "1".

{"error":{"root_cause":[{"type":"query_shard_exception","reason":"failed to create query: Can't parse boolean value [1], expected [true] or [false]","index":"assortment_de-0","index_uuid":"aVjoKkAaRhCpiHy0515nOA"}],"type":"search_phase_execution_exception","reason":"all shards failed","phase":"query","grouped":true,"failed_shards":[{"shard":0,"index":"assortment_de-0","node":"R8dCIDExT-2ABMPjIQ-M2w","reason":{"type":"query_shard_exception","reason":"failed to create query: Can't parse boolean value [1], expected [true] or [false]","index":"assortment_de-0","index_uuid":"aVjoKkAaRhCpiHy0515nOA","caused_by":{"type":"illegal_argument_exception","reason":"Can't parse boolean value [1], expected [true] or [false]"}}}]},"status":400}

This PR fixes the typing error (introducing a BC break).

Steps to reproduce

  1. add boolean field to index config
  2. filter by boolean field using `productList->addCondition($boolValue, $fieldName);
  3. Query productlist will result in the error above

Workaround

Pass the strings "true" or "false" in the addCondition() call, as it gets converted to bool values in the query later on.

@jremmurd jremmurd changed the title Fix boolean type in addCondition Fix boolean types in ProductList::addCondition() Feb 25, 2025
@sonarqubecloud
Copy link

@ghost ghost added the Pimcore:ToDo label Mar 11, 2025
@herbertroth
Copy link
Member

@jremmurd Could you please rebase this PR to the 2.x branch? There won’t be a 1.4 release. Thanks!

@herbertroth herbertroth changed the base branch from 1.x to 2.x April 7, 2025 13:04
@fashxp fashxp added this to the 2.0.0 milestone Apr 18, 2025
@fashxp
Copy link
Member

fashxp commented Apr 18, 2025

thx very much!

@sonarqubecloud
Copy link

@fashxp fashxp merged commit 1018cc8 into pimcore:2.x Apr 18, 2025
14 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Apr 18, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants