lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [2/3] lucenenet git commit: Fixes issues with AddAttribute in several places
Date Wed, 24 Dec 2014 22:56:32 GMT
Fixes issues with AddAttribute in several places


Project: http://git-wip-us.apache.org/repos/asf/lucenenet/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucenenet/commit/b7cf135f
Tree: http://git-wip-us.apache.org/repos/asf/lucenenet/tree/b7cf135f
Diff: http://git-wip-us.apache.org/repos/asf/lucenenet/diff/b7cf135f

Branch: refs/heads/master
Commit: b7cf135f12b06c174a8ddb1e5b73f0411bd1eb49
Parents: 26fd3f3
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Thu Dec 25 00:53:44 2014 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Thu Dec 25 00:53:44 2014 +0200

----------------------------------------------------------------------
 src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs               | 2 +-
 src/Lucene.Net.TestFramework/Analysis/MockTokenFilter.cs | 4 ++--
 src/Lucene.Net.Tests/core/Index/Test2BPostings.cs        | 8 +++++++-
 src/Lucene.Net.Tests/core/Index/Test2BPostingsBytes.cs   | 8 +++++++-
 src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs       | 7 ++++---
 5 files changed, 21 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b7cf135f/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs b/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs
index 0d60fb6..be54d1b 100644
--- a/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs
+++ b/src/Lucene.Net.Queries/Mlt/MoreLikeThis.cs
@@ -611,7 +611,7 @@ namespace Lucene.Net.Queries.Mlt
             {
                 int tokenCount = 0;
                 // for every token
-                var termAtt = ts.AddAttribute<CharTermAttribute>();
+                var termAtt = ts.AddAttribute<ICharTermAttribute>();
                 ts.Reset();
                 while (ts.IncrementToken())
                 {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b7cf135f/src/Lucene.Net.TestFramework/Analysis/MockTokenFilter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Analysis/MockTokenFilter.cs b/src/Lucene.Net.TestFramework/Analysis/MockTokenFilter.cs
index f692726..495a56d 100644
--- a/src/Lucene.Net.TestFramework/Analysis/MockTokenFilter.cs
+++ b/src/Lucene.Net.TestFramework/Analysis/MockTokenFilter.cs
@@ -45,8 +45,8 @@ namespace Lucene.Net.Analysis
 
         private readonly CharacterRunAutomaton Filter;
 
-        private readonly ICharTermAttribute TermAtt;// = AddAttribute<CharTermAttribute>();
-        private readonly IPositionIncrementAttribute PosIncrAtt;// = AddAttribute<PositionIncrementAttribute>();
+        private readonly ICharTermAttribute TermAtt;
+        private readonly IPositionIncrementAttribute PosIncrAtt;
         private int SkippedPositions;
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b7cf135f/src/Lucene.Net.Tests/core/Index/Test2BPostings.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/Test2BPostings.cs b/src/Lucene.Net.Tests/core/Index/Test2BPostings.cs
index bfc2d61..c477fc3 100644
--- a/src/Lucene.Net.Tests/core/Index/Test2BPostings.cs
+++ b/src/Lucene.Net.Tests/core/Index/Test2BPostings.cs
@@ -1,3 +1,4 @@
+using Lucene.Net.Analysis.Tokenattributes;
 using Lucene.Net.Documents;
 using NUnit.Framework;
 using System;
@@ -85,9 +86,14 @@ namespace Lucene.Net.Index
 
         public sealed class MyTokenStream : TokenStream
         {
-            internal readonly CharTermAttribute TermAtt;// = AddAttribute<CharTermAttribute>();
+            internal readonly ICharTermAttribute TermAtt;
             internal int Index;
 
+            public MyTokenStream()
+            {
+                TermAtt = AddAttribute<ICharTermAttribute>();
+            }
+
             public override bool IncrementToken()
             {
                 if (Index <= 'z')

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b7cf135f/src/Lucene.Net.Tests/core/Index/Test2BPostingsBytes.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/Test2BPostingsBytes.cs b/src/Lucene.Net.Tests/core/Index/Test2BPostingsBytes.cs
index 857e0eb..8fa2fad 100644
--- a/src/Lucene.Net.Tests/core/Index/Test2BPostingsBytes.cs
+++ b/src/Lucene.Net.Tests/core/Index/Test2BPostingsBytes.cs
@@ -1,3 +1,4 @@
+using Lucene.Net.Analysis.Tokenattributes;
 using Lucene.Net.Documents;
 using NUnit.Framework;
 
@@ -130,10 +131,15 @@ namespace Lucene.Net.Index
 
         public sealed class MyTokenStream : TokenStream
         {
-            internal readonly CharTermAttribute TermAtt;// = AddAttribute<CharTermAttribute>();
+            internal readonly ICharTermAttribute TermAtt;
             internal int Index;
             internal int n;
 
+            public MyTokenStream()
+            {
+                TermAtt = AddAttribute<ICharTermAttribute>();
+            }
+
             public override bool IncrementToken()
             {
                 if (Index < n)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/b7cf135f/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs b/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
index 587292e..e06d191 100644
--- a/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestIndexWriter.cs
@@ -1874,13 +1874,14 @@ namespace Lucene.Net.Index
 
         private class StringSplitTokenizer : Tokenizer
         {
-            internal string[] Tokens;
-            internal int Upto;
-            internal readonly CharTermAttribute TermAtt;// = AddAttribute<CharTermAttribute>();
+            private string[] Tokens;
+            private int Upto;
+            private readonly ICharTermAttribute TermAtt;
 
             public StringSplitTokenizer(TextReader r)
                 : base(r)
             {
+                TermAtt = AddAttribute<ICharTermAttribute>();
                 try
                 {
                     Reader = r;


Mime
View raw message