check for == 0 rather than > 0

This commit is contained in:
Simon Willnauer 2013-02-01 11:11:47 +01:00
parent c18ae4a194
commit 6468c15446
1 changed files with 4 additions and 8 deletions

View File

@ -247,10 +247,8 @@ public final class OrdinalsBuilder implements Closeable {
return new FilteredTermsEnum(termsEnum, false) { return new FilteredTermsEnum(termsEnum, false) {
@Override @Override
protected AcceptStatus accept(BytesRef term) throws IOException { protected AcceptStatus accept(BytesRef term) throws IOException {
if (NumericUtils.getPrefixCodedLongShift(term) > 0) { // we stop accepting terms once we moved across the prefix codec terms - redundant values!
return AcceptStatus.END; return NumericUtils.getPrefixCodedLongShift(term) == 0 ? AcceptStatus.YES : AcceptStatus.END;
} // we stop accepting terms once we moved across the prefix codec terms - redundant values!
return AcceptStatus.YES;
} }
}; };
} }
@ -264,10 +262,8 @@ public final class OrdinalsBuilder implements Closeable {
@Override @Override
protected AcceptStatus accept(BytesRef term) throws IOException { protected AcceptStatus accept(BytesRef term) throws IOException {
if (NumericUtils.getPrefixCodedIntShift(term) > 0) { // we stop accepting terms once we moved across the prefix codec terms - redundant values!
return AcceptStatus.END; return NumericUtils.getPrefixCodedIntShift(term) == 0 ? AcceptStatus.YES : AcceptStatus.END;
} // we stop accepting terms once we moved across the prefix codec terms - redundant values!
return AcceptStatus.YES;
} }
}; };
} }