lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ccurr...@apache.org
Subject [Lucene.Net] svn commit: r1234280 - in /incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk: src/contrib/Snowball/SF/Snowball/SnowballProgram.cs test/contrib/Snowball/Analysis/Snowball/TestSnowball.cs
Date Sat, 21 Jan 2012 07:55:03 GMT
Author: ccurrens
Date: Sat Jan 21 07:55:02 2012
New Revision: 1234280

URL: http://svn.apache.org/viewvc?rev=1234280&view=rev
Log:
[LUCENENET-54] - Changed substring to use length instead of ending index

Modified:
    incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/contrib/Snowball/SF/Snowball/SnowballProgram.cs
    incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/contrib/Snowball/Analysis/Snowball/TestSnowball.cs

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/contrib/Snowball/SF/Snowball/SnowballProgram.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/contrib/Snowball/SF/Snowball/SnowballProgram.cs?rev=1234280&r1=1234279&r2=1234280&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/contrib/Snowball/SF/Snowball/SnowballProgram.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/src/contrib/Snowball/SF/Snowball/SnowballProgram.cs
Sat Jan 21 07:55:02 2012
@@ -51,13 +51,13 @@ namespace SF.Snowball
         virtual public System.String GetCurrent()
         {
             string result = current.ToString();
-            // Make a new StringBuffer.  If we reuse the old one, and a user of
-            // the library keeps a reference to the buffer returned (for example,
-            // by converting it to a String in a way which doesn't force a copy),
-            // the buffer size will not decrease, and we will risk wasting a large
-            // amount of memory.
-            // Thanks to Wolfram Esser for spotting this problem.
-            current = new StringBuilder();
+            // Make a new StringBuffer.  If we reuse the old one, and a user of
+            // the library keeps a reference to the buffer returned (for example,
+            // by converting it to a String in a way which doesn't force a copy),
+            // the buffer size will not decrease, and we will risk wasting a large
+            // amount of memory.
+            // Thanks to Wolfram Esser for spotting this problem.
+            current = new StringBuilder();
             return result;
         }
 
@@ -481,7 +481,7 @@ namespace SF.Snowball
 			int len = ket - bra;
 			//// s.Replace(s.ToString(0, s.Length - 0), current.ToString(bra, ket), 0, s.Length -
0);
 			s.Remove(0, s.Length);
-            s.Append(current.ToString(bra, ket));
+            s.Append(current.ToString(bra, len));
 			return s;
 		}
 		

Modified: incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/contrib/Snowball/Analysis/Snowball/TestSnowball.cs
URL: http://svn.apache.org/viewvc/incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/contrib/Snowball/Analysis/Snowball/TestSnowball.cs?rev=1234280&r1=1234279&r2=1234280&view=diff
==============================================================================
--- incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/contrib/Snowball/Analysis/Snowball/TestSnowball.cs
(original)
+++ incubator/lucene.net/branches/Lucene.Net.3.0.3/trunk/test/contrib/Snowball/Analysis/Snowball/TestSnowball.cs
Sat Jan 21 07:55:02 2012
@@ -108,6 +108,17 @@ namespace Lucene.Net.Analysis.Snowball
             Assert.AreEqual(new Payload(new byte[] { 0, 1, 2, 3 }), payloadAtt.GetPayload());
         }
 
+        [Test(Description = "LUCENENET-54")]
+        public void TestJiraLuceneNet54()
+        {
+            var analyzer = new SnowballAnalyzer(Lucene.Net.Util.Version.LUCENE_CURRENT, "Finnish");
+            var input = new StringReader("terve");
+            var tokenStream = analyzer.TokenStream("fieldName", input);
+            var termAttr = tokenStream.AddAttribute<TermAttribute>();
+            Assert.That(tokenStream.IncrementToken(), Is.True);
+            Assert.That(termAttr.Term(), Is.EqualTo("terv"));
+        }
+
         private sealed class TestTokenStream : TokenStream
         {
             private TermAttribute termAtt;



Mime
View raw message