don't create strings, not needed with lucene trunk

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/branches/solr@924142 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2010-03-17 03:51:57 +00:00
parent 5d9b7b2089
commit b44d8b0763
1 changed files with 7 additions and 3 deletions

View File

@ -122,10 +122,14 @@ class SnowballPorterFilter extends TokenFilter {
return true;
}
stemmer.setCurrent(new String(termBuffer, 0, len));//ugh, wish the Stemmer took a char array
stemmer.setCurrent(termBuffer, len);
stemmer.stem();
String newstr = stemmer.getCurrent();
termAtt.setTermBuffer(newstr.toCharArray(), 0, newstr.length());
final char finalTerm[] = stemmer.getCurrentBuffer();
final int newLength = stemmer.getCurrentBufferLength();
if (finalTerm != termBuffer)
termAtt.setTermBuffer(finalTerm, 0, newLength);
else
termAtt.setTermLength(newLength);
return true;
}