LUCENE-2588: make sure minPrefix never exceeds current term's length

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@983151 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2010-08-07 00:35:41 +00:00
parent 98c139d717
commit c2ad126364
1 changed files with 1 additions and 1 deletions

View File

@ -108,7 +108,7 @@ public class SimpleStandardTermsIndexWriter extends StandardTermsIndexWriter {
// we can safely strip off the non-distinguishing
// suffix to save RAM in the loaded terms index.
final int limit = Math.min(lastTerm.length, text.length);
int minPrefixDiff = 1+lastTerm.length;
int minPrefixDiff = Math.min(1+lastTerm.length, text.length);
for(int byteIdx=0;byteIdx<limit;byteIdx++) {
if (lastTerm.bytes[lastTerm.offset+byteIdx] != text.bytes[text.offset+byteIdx]) {
minPrefixDiff = byteIdx+1;