Problem/Motivation
When using a view to display the output of an search_api_index, for example to create an overview page with several filters on it. Boolean fields are queried using 1 or 0 instead of 'true' or 'false'.
Meilisearch stores booleans as lowercase string (see https://www.meilisearch.com/docs/learn/engine/datatypes#boolean)
Steps to reproduce
Create a index and store a boolean field on that index, as type 'boolean'
Create a view for that index, and filter on that boolean field.
The filter won't work, and in worse case scenario your view will remain empty.
Proposed resolution
A small change in Drupal\search_api_meilisearch\Parser\ScalarValueParser.php that changes the value into 'true' or 'false' will fix this issue.
I did try to move the value fix to MeilisearchUtils::formatConditionValue function, however that would imply that the current field or field_type would be added to that method and that makes no sense for any other value except a boolean.
Remaining tasks
Check MR !53 as proposed solution.
User interface changes
None
API changes
None
Data model changes
None
Issue fork search_api_meilisearch-3473369
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
rene bakxComment #5
bcizej commented@rene thanks for reporting and contribution.
Branch has been rebased, added tests and refactored code to use a separate parser class for booleans.
Comment #6
Anonymous (not verified) commentedHello, I've tested this MR with both D10 and D11 and in both cases I can confirm that this is working correctly in both cases. I've taken a look into the MR and code looks good so I'm marking this issue with RTBC.
Comment #8
bcizej commented