SearchKit "If/Else" field transformation does not behave as described
First of all, the description for the "If/Else" field transformation is backwards. It says:
"If the field is empty, the first value, otherwise the second."
The order of "first" and "second" in that sentence are reversed. And, since we're just talking about the MySQL IF construct here, a closer description would be (according to the MYSQL docs regarding the if/else construct):
"If the field is nonzero and non-NULL, the first value, otherwise the second."
But even that isn't totally accurate. It leaves out the fact that the field (the comparison value) will be cast to an integer for comparison. In MySQL, strings starting with any character except 1-9 will be cast to 0 (false).
+---------------------------+
| IF(true, 'true', 'false') |
+---------------------------+
| true |
+---------------------------+
+----------------------------+
| IF(false, 'true', 'false') |
+----------------------------+
| false |
+----------------------------+
+------------------------+
| IF(1, 'true', 'false') |
+------------------------+
| true |
+------------------------+
+------------------------+
| IF(0, 'true', 'false') |
+------------------------+
| false |
+------------------------+
+---------------------------+
| IF(null, 'true', 'false') |
+---------------------------+
| false |
+---------------------------+
+---------------------------------------+
| IF("5_golden_rings", 'true', 'false') |
+---------------------------------------+
| true |
+---------------------------------------+
+--------------------------------------+
| IF("my_1_and_only", 'true', 'false') |
+--------------------------------------+
| false |
+--------------------------------------+
So an accurate description of this field transformation is:
"If the field is boolean TRUE, any number except 0, or a string not starting with the digits 1-9, the first value, otherwise the second."