From the above debug logging you can see that enum.next() has returned a TermEnum with a text of '10'. While this is logically greater than or equal to the preceeding text according to String.compareTo(), I'm uncertain as to where the '10' text is coming from. As an example, document #86 returns in another search the following:
Could this be the text from a term in a different field? From a quick glance, it doesn't look like you're checking that your enumeration stays within the field.
TermEnum enum = reader.terms(new Term(field, start));
It is indeed possible that the '10' value could be text from another field.
I must say that as a user of the API I'm (obviously) surprised if the above API call returned any results outside of the field specified. If that is indeed the case if is almost certainly the cause of the issue. I'll add some more logging to confirm.
Regards,
Bruce Ritchie
smime.p7s
Description: S/MIME Cryptographic Signature
