Fixing the positioning where nextToken returns null resets it to zero. This was blowing up indexing document fields ending in a partial phrase match.