public CompoundToken(CompoundWordTokenFilterBase outerInstance, int offset, int length)
{
this.txt = outerInstance.termAtt.SubSequence(offset, offset + length);
// offsets of the original word
int startOff = outerInstance.offsetAtt.StartOffset();
int endOff = outerInstance.offsetAtt.EndOffset();
#pragma warning disable 612, 618
if (outerInstance.matchVersion.OnOrAfter(LuceneVersion.LUCENE_44) || endOff - startOff != outerInstance.termAtt.Length)
#pragma warning restore 612, 618
{
// if length by start + end offsets doesn't match the term text then assume
// this is a synonym and don't adjust the offsets.
this.startOffset = startOff;
this.endOffset = endOff;
}
else
{
int newStart = startOff + offset;
this.startOffset = newStart;
this.endOffset = newStart + length;
}
}
}