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;
}