Closed Edicatax closed 1 year ago
Can you specify a small object and entity object to help me to reproduce the issue? Or maybe you can add a test case to here and I can work on it
I have reproduced our (failing) case in the tests for AutoFilterer locally and it's passing with flying colours, so I suspect I've missed something odd in our setup that is messing with how the filters are generated :upside_down_face: . I'll dig a bit deeper but I now strongly suspect the error is on our side. I'll open a new issue if I do find something wrong.
Since the
ArraySearchFilterAttribute
by default returnsExpression.Constant(true)
if the array is empty or not passed, an OR query that has other filter criteria will always return everything as the resulting expression becomes something like:This obviously is always simply
true
and so as long as the array attribute exists and is not passed other criteria are effectively ignored. Notably AND queries work as normal with this implementation since it is just one of many expressions that should evaluate totrue
.We have solved this issue for ourselves by creating an attribute that inherits from
ArraySearchFilterAttribute
that simply returnsnull
if the array is empty, which seems to fix it for OR as well as AND queries.How is the
ArraySearchFilterAttribute
supposed to work, is this described functionality correct? If not, I can open a quick PR to apply our fix to theArraySearchFilterAttribute
for inclusion in a future release.