If I use the AnyOfDocId filter with an empty list, Postgres raises a sql syntax error:
PDOException: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near ")" LINE 3: WHERE id IN()
We should check if the the list is empty and return an empty iterator without performing any query.