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 for several dictionary lookups
Date Tue, 30 Dec 2014 06:14:43 GMT
fixes for several dictionary lookups


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

Branch: refs/heads/master
Commit: 6f88e8aa2ff096b8d8e2059ee15e20f6a40921ab
Parents: cb4bbe0
Author: Laimonas Simutis <laimis@gmail.com>
Authored: Mon Dec 29 21:17:13 2014 -0500
Committer: Laimonas Simutis <laimis@gmail.com>
Committed: Mon Dec 29 21:17:13 2014 -0500

----------------------------------------------------------------------
 src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xTermVectorsReader.cs | 4 ++--
 src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsReader.cs | 4 ++--
 src/Lucene.Net.Core/Codecs/Perfield/PerFieldPostingsFormat.cs    | 3 +--
 src/Lucene.Net.Core/Index/TieredMergePolicy.cs                   | 4 ++--
 src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs         | 4 +++-
 src/Lucene.Net.Core/Util/Fst/FST.cs                              | 4 ++--
 6 files changed, 12 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6f88e8aa/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xTermVectorsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xTermVectorsReader.cs b/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xTermVectorsReader.cs
index ae4796e..7b474be 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xTermVectorsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene3x/Lucene3xTermVectorsReader.cs
@@ -326,8 +326,8 @@ namespace Lucene.Net.Codecs.Lucene3x
                     return null;
                 }
 
-                int fieldIndex = FieldNumberToIndex[fieldInfo.Number];
-                if (fieldIndex == null)
+                int fieldIndex;
+                if (!FieldNumberToIndex.TryGetValue(fieldInfo.Number, out fieldIndex))
                 {
                     // Term vectors were not indexed for this field
                     return null;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6f88e8aa/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsReader.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsReader.cs b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsReader.cs
index 4c4b4d8..4e9352c 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsReader.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene40/Lucene40TermVectorsReader.cs
@@ -310,8 +310,8 @@ namespace Lucene.Net.Codecs.Lucene40
                     return null;
                 }
 
-                int fieldIndex = FieldNumberToIndex[fieldInfo.Number];
-                if (fieldIndex == null)
+                int fieldIndex;
+                if (!FieldNumberToIndex.TryGetValue(fieldInfo.Number, out fieldIndex))
                 {
                     // Term vectors were not indexed for this field
                     return null;

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6f88e8aa/src/Lucene.Net.Core/Codecs/Perfield/PerFieldPostingsFormat.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Perfield/PerFieldPostingsFormat.cs b/src/Lucene.Net.Core/Codecs/Perfield/PerFieldPostingsFormat.cs
index f21de45..60f90fe 100644
--- a/src/Lucene.Net.Core/Codecs/Perfield/PerFieldPostingsFormat.cs
+++ b/src/Lucene.Net.Core/Codecs/Perfield/PerFieldPostingsFormat.cs
@@ -121,8 +121,7 @@ namespace Lucene.Net.Codecs.Perfield
                     // First time we are seeing this format; create a new instance
 
                     // bump the suffix
-                    Suffixes.TryGetValue(formatName, out suffix);
-                    if (suffix == null)
+                    if (!Suffixes.TryGetValue(formatName, out suffix))
                     {
                         suffix = 0;
                     }

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6f88e8aa/src/Lucene.Net.Core/Index/TieredMergePolicy.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Index/TieredMergePolicy.cs b/src/Lucene.Net.Core/Index/TieredMergePolicy.cs
index 0482c2c..f453c89 100644
--- a/src/Lucene.Net.Core/Index/TieredMergePolicy.cs
+++ b/src/Lucene.Net.Core/Index/TieredMergePolicy.cs
@@ -685,8 +685,8 @@ namespace Lucene.Net.Index
             bool? segmentIsOriginal = false;
             foreach (SegmentCommitInfo info in infos.Segments)
             {
-                bool? isOriginal = segmentsToMerge[info];
-                if (isOriginal != null)
+                bool? isOriginal;
+                if (segmentsToMerge.TryGetValue(info, out isOriginal))
                 {
                     segmentIsOriginal = isOriginal;
                     if (!merging.Contains(info))

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6f88e8aa/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs b/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
index 793d20b..8ac68b1 100644
--- a/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
+++ b/src/Lucene.Net.Core/Store/RateLimitedDirectoryWrapper.cs
@@ -97,7 +97,9 @@ namespace Lucene.Net.Store
                 throw new System.ArgumentException("Context must not be null");
             }
             //int ord = context.ordinal();
-            RateLimiter limiter = ContextRateLimiters[context];
+            RateLimiter limiter;
+            ContextRateLimiters.TryGetValue(context, out limiter);
+
             if (mbPerSec == null)
             {
                 if (limiter != null)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/6f88e8aa/src/Lucene.Net.Core/Util/Fst/FST.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Util/Fst/FST.cs b/src/Lucene.Net.Core/Util/Fst/FST.cs
index 4f5596b..06a0446 100644
--- a/src/Lucene.Net.Core/Util/Fst/FST.cs
+++ b/src/Lucene.Net.Core/Util/Fst/FST.cs
@@ -1901,8 +1901,8 @@ namespace Lucene.Net.Util.Fst
                             bool doWriteTarget = TargetHasArcs(arc) && (flags &
BIT_TARGET_NEXT) == 0;
                             if (doWriteTarget)
                             {
-                                int ptr = topNodeMap[(int)arc.Target];
-                                if (ptr != null)
+                                int ptr;
+                                if (topNodeMap.TryGetValue((int)arc.Target, out ptr))
                                 {
                                     absPtr = ptr;
                                 }


Mime
View raw message