IS_EMPTY not handled by Low Search for "select" fields.
Currently Grid search doesn't handle "IS_EMPTY" correctly for certain field types. A multi-select for example stores an empty value as NULL.
I've updated the code (which I hate doing)
file "filter.low_search.php"
method "_get_where_search"
line 228
instead of:
$sql[] = sprintf("(%s %s %s)", $field, $operand, $item);
I've added a bit of a plaster:
$temp_sql = sprintf("(%s %s %s)", $field, $operand, $item);
if($empty){
$temp_sql = sprintf(
"(%s OR (%s %s %s))",
$temp_sql,
$field,
(($exclude) ? 'IS NOT' : 'IS'),
"NULL"
);
}
$sql[] = $temp_sql;
Replies
Low 15 Apr 2015 15:48
Thanks for reporting. I'll look into it.
For now, if you want to remove the hack, you can also disallow NULL on a DB level for that Grid column. That should force EE to use an empty string instead of a NULL value.
Low 17 Apr 2015 12:31
FYI: as this behaves the same as native EE stuff, it was marked as a bug there: https://support.ellislab.com/bugs/det...
Low 23 Apr 2015 09:18
Should be fixed in LS 4.2.0.