mirror of https://github.com/apache/lucene.git
LUCENE-152: minor optimization to avoid some char[]/String creation
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1134328 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6f8344a2f7
commit
eca56e0564
|
@ -55,8 +55,7 @@ public final class KStemFilter extends TokenFilter {
|
|||
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);
|
||||
termAttribute.setEmpty().append(stemmer.asCharSequence());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -1373,6 +1373,10 @@ public class KStemmer {
|
|||
return word.toString();
|
||||
}
|
||||
|
||||
CharSequence asCharSequence() {
|
||||
return result != null ? result : word;
|
||||
}
|
||||
|
||||
String getString() {
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue