IndexLeafPlanner: Use the syntax sugar for PartialFunction

The reason we couldn't get it to work before is that the desugared code
evaluates the predicate twice and the unit test was returning
the same iterator object every time so the first time it was used,
it'd be consumed.