leverage AcceptStatus.END

This commit is contained in:
Michael Gibney 2023-03-20 13:22:44 -04:00
parent 082a4c7436
commit 1f8c07553f
No known key found for this signature in database
GPG Key ID: 91046CF971D1906C
1 changed files with 3 additions and 6 deletions

View File

@ -149,18 +149,15 @@ public class PrefixQuery extends MultiTermQuery {
@Override @Override
protected BytesRef nextSeekTerm(BytesRef currentTerm) { protected BytesRef nextSeekTerm(BytesRef currentTerm) {
if (currentTerm == null) { assert currentTerm == null;
return startTerm; return startTerm;
} else {
return null;
}
} }
@Override @Override
protected AcceptStatus accept(BytesRef candidate) { protected AcceptStatus accept(BytesRef candidate) {
if (thresholdLength == candidate.length if (thresholdLength == candidate.length
&& determinant == Byte.toUnsignedInt(candidate.bytes[candidate.offset + tdi])) { && determinant == Byte.toUnsignedInt(candidate.bytes[candidate.offset + tdi])) {
return AcceptStatus.NO_AND_SEEK; return AcceptStatus.END;
} else { } else {
return AcceptStatus.YES; return AcceptStatus.YES;
} }