bcosca/fatfree — pull request #245 by ikkez (2013-01-26 21:25:17+00:00)
Title: Bug fix: filter returns records where the filtered field does not exist

When you do a filter like num2 < 5 ... then Jig also returns records, where num2 is not defined.
before #230 we had some isset() checks in the $_expr, after #230 you kicked them and solved the undefined issue by adding default null values for those fields to the scope (with that extract($_row+$_add); thing), which is as good solution IMO. But comparing the results with SQL or Mongo now revealed, that Jigs return also contains records where the field, which was searched for, is not existing. To solve that, i added the isset() checks again (now in a better version than in my #230 approach)

it transforms $_expr like
`$num2 <= 1`
to
`isset($num2) && $num2 <= 1`

and filters like
`( $num2 < 2 AND $num1 > 1 ) OR preg_match('/o9$/',$title)`
to
`( isset($num2) && $num2 < 2 AND isset($num1) && $num1 > 1 ) OR preg_match('/o9$/',$title) && isset($title)`

i hope you like it.
cheers