reugn opened a new pull request, #17020: URL: https://github.com/apache/lucene/pull/17020
`CharTermAttributeImpl#clone` copies `builder`, which holds the bytes of the last term passed to `getBytesRef()` on that instance. That term can be much longer than the current one, and can come from an earlier analysis that reused the same components. `CachingTokenFilter` calls `captureState()` for every token, so each cached token keeps its own copy of those old bytes. The copy is never read, since `getBytesRef()` rebuilds the bytes from the chars on every call. This change gives the clone a new, empty `BytesRefBuilder` and drops the copy. The clone still doesn't share the builder with the original. The new test fails without the fix, since the clone of a 5-char term keeps 11,368 bytes after a 10,000-char term. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
