lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [2/2] lucenenet git commit: Using proper method of comparing sets, removing noisy method
Date Fri, 20 Feb 2015 07:38:34 GMT
Using proper method of comparing sets, removing noisy method

Closes #106


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

Branch: refs/heads/master
Commit: 5f3998ba8ab5c4bdafcd154e30bdcf7eb28b5826
Parents: 0b794bb
Author: Itamar Syn-Hershko <itamar@code972.com>
Authored: Fri Feb 20 09:29:50 2015 +0200
Committer: Itamar Syn-Hershko <itamar@code972.com>
Committed: Fri Feb 20 09:29:50 2015 +0200

----------------------------------------------------------------------
 src/Lucene.Net.Core/Index/BufferedUpdates.cs            | 12 ++++--------
 .../core/Index/TestDocumentsWriterDeleteQueue.cs        | 10 +++++-----
 2 files changed, 9 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5f3998ba/src/Lucene.Net.Core/Index/BufferedUpdates.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/BufferedUpdates.cs b/src/Lucene.Net.Core/Index/BufferedUpdates.cs
index 295034c..706bd14 100644
--- a/src/Lucene.Net.Core/Index/BufferedUpdates.cs
+++ b/src/Lucene.Net.Core/Index/BufferedUpdates.cs
@@ -120,11 +120,13 @@ namespace Lucene.Net.Index
 
         internal readonly AtomicInteger NumTermDeletes = new AtomicInteger();
         internal readonly AtomicInteger NumNumericUpdates = new AtomicInteger();
-        internal readonly AtomicInteger NumBinaryUpdates = new AtomicInteger();
-        internal readonly IDictionary<Term, int?> Terms = new Dictionary<Term, int?>();
+        internal readonly AtomicInteger NumBinaryUpdates = new AtomicInteger();        
         internal readonly IDictionary<Query, int?> Queries = new Dictionary<Query,
int?>();
         internal readonly IList<int?> DocIDs = new List<int?>();
 
+        // TODO LUCENENET make get access internal and make accessible from Tests
+        public IDictionary<Term, int?> Terms { get; private set; }
+
         // Map<dvField,Map<updateTerm,NumericUpdate>>
         // For each field we keep an ordered list of NumericUpdates, key'd by the
         // update Term. OrderedDictionary guarantees we will later traverse the map in
@@ -156,12 +158,6 @@ namespace Lucene.Net.Index
             this.BytesUsed = new AtomicLong();
         }
 
-        // Do not use outside of Nunit
-        public IDictionary<Term, int?> Terms_Nunit()
-        {
-            return Terms;
-        }
-
         public override string ToString()
         {
             if (VERBOSE_DELETES)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/5f3998ba/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterDeleteQueue.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterDeleteQueue.cs b/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterDeleteQueue.cs
index 426825b..205e0ff 100644
--- a/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterDeleteQueue.cs
+++ b/src/Lucene.Net.Tests/core/Index/TestDocumentsWriterDeleteQueue.cs
@@ -80,9 +80,9 @@ namespace Lucene.Net.Index
                 }
                 Assert.AreEqual(j + 1, queue.NumGlobalTermDeletes());
             }
-            Assert.AreEqual(uniqueValues, bd1.Terms_Nunit().Keys);
-            Assert.AreEqual(uniqueValues, bd2.Terms_Nunit().Keys);
-            HashSet<Term> frozenSet = new HashSet<Term>();
+            assertEquals(uniqueValues, new HashSet<Term>(bd1.Terms.Keys));
+            assertEquals(uniqueValues, new HashSet<Term>(bd2.Terms.Keys));
+            var frozenSet = new HashSet<Term>();
             foreach (Term t in queue.FreezeGlobalBuffer(null).TermsIterable())
             {
                 BytesRef bytesRef = new BytesRef();
@@ -97,7 +97,7 @@ namespace Lucene.Net.Index
         {
             for (int i = start; i <= end; i++)
             {
-                Assert.AreEqual(Convert.ToInt32(end), deletes.Terms_Nunit()[new Term("id",
ids[i].ToString())]);
+                Assert.AreEqual(Convert.ToInt32(end), deletes.Terms[new Term("id", ids[i].ToString())]);
             }
         }
 
@@ -240,7 +240,7 @@ namespace Lucene.Net.Index
                 queue.UpdateSlice(slice);
                 BufferedUpdates deletes = updateThread.Deletes;
                 slice.Apply(deletes, BufferedUpdates.MAX_INT);
-                assertEquals(uniqueValues, deletes.Terms_Nunit().Keys);
+                assertEquals(uniqueValues, new HashSet<Term>(deletes.Terms.Keys));
             }
             queue.TryApplyGlobalSlice();
             HashSet<Term> frozenSet = new HashSet<Term>();


Mime
View raw message