Description
It happens in both impls, so I think the problem is in NearSpansPayloadOrdered. Maybe atFirstInCurrentDoc gets set without matchStart getting set?
Can be triggered more generally in tests like this:
@Override public int nextStartPosition() throws IOException { if (atFirstInCurrentDoc) { atFirstInCurrentDoc = false; assert matchStart >= 0; // add this assert return matchStart; }