Index: modules/analysis/common/src/java/org/apache/lucene/analysis/en/KStemmer.java =================================================================== --- modules/analysis/common/src/java/org/apache/lucene/analysis/en/KStemmer.java (revision 1134263) +++ modules/analysis/common/src/java/org/apache/lucene/analysis/en/KStemmer.java (working copy) @@ -1372,7 +1372,8 @@ if (s != null) return s; return word.toString(); } - + + /** @lucene.internal Returns the stem, or null if the stem is in the char[] returned by getChars()/getLength() */ String getString() { return result; } Index: modules/analysis/common/src/java/org/apache/lucene/analysis/en/KStemFilter.java =================================================================== --- modules/analysis/common/src/java/org/apache/lucene/analysis/en/KStemFilter.java (revision 1134263) +++ modules/analysis/common/src/java/org/apache/lucene/analysis/en/KStemFilter.java (working copy) @@ -55,8 +55,15 @@ char[] term = termAttribute.buffer(); int len = termAttribute.length(); if ((!keywordAtt.isKeyword()) && stemmer.stem(term, len)) { - char[] chars = stemmer.asString().toCharArray(); - termAttribute.copyBuffer(chars, 0, chars.length); + String result = stemmer.getString(); + if (result != null) { + int stemLen = result.length(); + termAttribute.resizeBuffer(stemLen); + termAttribute.setLength(stemLen); + result.getChars(0, stemLen, termAttribute.buffer(), 0); + } else { + termAttribute.copyBuffer(stemmer.getChars(), 0, stemmer.getLength()); + } } return true;