private void GeneratePart(bool isSingleWord)
{
ClearAttributes();
termAttribute.CopyBuffer(savedBuffer, iterator.current, iterator.end - iterator.current);
int startOffset = savedStartOffset + iterator.current;
int endOffset = savedStartOffset + iterator.end;
if (hasIllegalOffsets)
{
// historically this filter did this regardless for 'isSingleWord',
// but we must do a sanity check:
if (isSingleWord && startOffset <= savedEndOffset)
{
offsetAttribute.SetOffset(startOffset, savedEndOffset);
}
else
{
offsetAttribute.SetOffset(savedStartOffset, savedEndOffset);
}
}
else
{
offsetAttribute.SetOffset(startOffset, endOffset);
}
posIncAttribute.PositionIncrement = Position(false);
typeAttribute.Type = savedType;
}