lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject lucenenet git commit: fix LogMergePolicy IsMerged logic
Date Sat, 31 Jan 2015 21:23:36 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master fe965306b -> 2c566585c


fix LogMergePolicy IsMerged logic


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

Branch: refs/heads/master
Commit: 2c566585cb1784a3ab5ea07bf2e349397c93f590
Parents: fe96530
Author: Laimonas Simutis <laimis@gmail.com>
Authored: Sat Jan 31 16:14:41 2015 -0500
Committer: Laimonas Simutis <laimis@gmail.com>
Committed: Sat Jan 31 16:14:41 2015 -0500

----------------------------------------------------------------------
 src/Lucene.Net.Core/Index/LogMergePolicy.cs         | 6 +++---
 src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs | 5 ++---
 2 files changed, 5 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2c566585/src/Lucene.Net.Core/Index/LogMergePolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/LogMergePolicy.cs b/src/Lucene.Net.Core/Index/LogMergePolicy.cs
index d661a25..d3cb072 100644
--- a/src/Lucene.Net.Core/Index/LogMergePolicy.cs
+++ b/src/Lucene.Net.Core/Index/LogMergePolicy.cs
@@ -224,7 +224,7 @@ namespace Lucene.Net.Index
             int numSegments = infos.Size();
             int numToMerge = 0;
             SegmentCommitInfo mergeInfo = null;
-            bool? segmentIsOriginal = false;
+            bool segmentIsOriginal = false;
             for (int i = 0; i < numSegments && numToMerge <= maxNumSegments;
i++)
             {
                 SegmentCommitInfo info = infos.Info(i);
@@ -232,13 +232,13 @@ namespace Lucene.Net.Index
                 segmentsToMerge.TryGetValue(info, out isOriginal);
                 if (isOriginal != null)
                 {
-                    segmentIsOriginal = isOriginal;
+                    segmentIsOriginal = isOriginal.Value;
                     numToMerge++;
                     mergeInfo = info;
                 }
             }
 
-            return numToMerge <= maxNumSegments && (numToMerge != 1 || segmentIsOriginal
!= false || IsMerged(infos, mergeInfo));
+            return numToMerge <= maxNumSegments && (numToMerge != 1 || !segmentIsOriginal
|| IsMerged(infos, mergeInfo));
         }
 
         /// <summary>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/2c566585/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
index bd78f9d..c23e659 100644
--- a/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
+++ b/src/Lucene.Net.TestFramework/Util/LuceneTestCase.cs
@@ -974,9 +974,8 @@ namespace Lucene.Net.Util
 
         public static LogMergePolicy NewLogMergePolicy(Random r)
         {
-            // LUCENENET TODO: don't use LogByteSizeMergePolicy until it is fixed
-            //LogMergePolicy logmp = r.NextBoolean() ? (LogMergePolicy)new LogDocMergePolicy()
: new LogByteSizeMergePolicy();
-            LogMergePolicy logmp = new LogDocMergePolicy();
+            LogMergePolicy logmp = r.NextBoolean() ? (LogMergePolicy)new LogDocMergePolicy()
: new LogByteSizeMergePolicy();
+            
             logmp.CalibrateSizeByDeletes = r.NextBoolean();
             if (Rarely(r))
             {


Mime
View raw message