fix syn test bug

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1228704 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael McCandless 2012-01-07 19:28:07 +00:00
parent e855df6879
commit defd51a11b
1 changed files with 10 additions and 3 deletions

View File

@ -260,9 +260,16 @@ public class TestSynonymMapFilter extends BaseTokenStreamTestCase {
} else {
outputs[matchIDX] = outputs[matchIDX] + "/" + synOutputs[synUpto++];
}
if (synOutputs.length == 1) {
// Add endOffset
outputs[matchIDX] = outputs[matchIDX] + ":" + ((inputIDX*2) + syn.in.length());
final int endOffset;
if (matchIDX < numInputs) {
if (synOutputs.length == 1) {
// Add full endOffset
endOffset = (inputIDX*2) + syn.in.length();
} else {
// Add endOffset matching input token's
endOffset = (matchIDX*2) + 1;
}
outputs[matchIDX] = outputs[matchIDX] + ":" + endOffset;
}
}
}