lucene-solr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r924142 - /lucene/solr/branches/solr/src/java/org/apache/solr/analysis/SnowballPorterFilterFactory.java
Date Wed, 17 Mar 2010 03:51:57 GMT
Author: rmuir
Date: Wed Mar 17 03:51:57 2010
New Revision: 924142

URL: http://svn.apache.org/viewvc?rev=924142&view=rev
Log:
don't create strings, not needed with lucene trunk

Modified:
    lucene/solr/branches/solr/src/java/org/apache/solr/analysis/SnowballPorterFilterFactory.java

Modified: lucene/solr/branches/solr/src/java/org/apache/solr/analysis/SnowballPorterFilterFactory.java
URL: http://svn.apache.org/viewvc/lucene/solr/branches/solr/src/java/org/apache/solr/analysis/SnowballPorterFilterFactory.java?rev=924142&r1=924141&r2=924142&view=diff
==============================================================================
--- lucene/solr/branches/solr/src/java/org/apache/solr/analysis/SnowballPorterFilterFactory.java
(original)
+++ lucene/solr/branches/solr/src/java/org/apache/solr/analysis/SnowballPorterFilterFactory.java
Wed Mar 17 03:51:57 2010
@@ -122,10 +122,14 @@ class SnowballPorterFilter extends Token
       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;
   }



Mime
View raw message