lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [1/5] lucenenet git commit: use GetTryValue for dictionary lookups
Date Wed, 31 Dec 2014 08:39:44 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/master aa1f8b4f0 -> 971b6a320


use GetTryValue for dictionary lookups


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

Branch: refs/heads/master
Commit: 0a03242e5f104c55e11a632ea8307e47d05bd0d4
Parents: 6f88e8a
Author: Laimonas Simutis <laimis@gmail.com>
Authored: Tue Dec 30 20:53:55 2014 -0500
Committer: Laimonas Simutis <laimis@gmail.com>
Committed: Tue Dec 30 20:53:55 2014 -0500

----------------------------------------------------------------------
 .../Codecs/Lucene42/Lucene42DocValuesProducer.cs          | 10 ++++------
 src/Lucene.Net.Core/Search/LiveFieldValues.cs             |  5 +++--
 2 files changed, 7 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0a03242e/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs b/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
index 2648940..b635128 100644
--- a/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
+++ b/src/Lucene.Net.Core/Codecs/Lucene42/Lucene42DocValuesProducer.cs
@@ -356,8 +356,8 @@ namespace Lucene.Net.Codecs.Lucene42
         {
             lock (this)
             {
-                BinaryDocValues instance = BinaryInstances[field.Number];
-                if (instance == null)
+                BinaryDocValues instance;
+                if (!BinaryInstances.TryGetValue(field.Number, out instance))
                 {
                     instance = LoadBinary(field);
                     BinaryInstances[field.Number] = instance;
@@ -435,8 +435,7 @@ namespace Lucene.Net.Codecs.Lucene42
             FST<long> instance;
             lock (this)
             {
-                instance = FstInstances[field.Number];
-                if (instance == null)
+                if (!FstInstances.TryGetValue(field.Number, out instance))
                 {
                     Data.Seek(entry.Offset);
                     instance = new FST<long>(Data, PositiveIntOutputs.Singleton);
@@ -554,8 +553,7 @@ namespace Lucene.Net.Codecs.Lucene42
             FST<long> instance;
             lock (this)
             {
-                instance = FstInstances[field.Number];
-                if (instance == null)
+                if (!FstInstances.TryGetValue(field.Number, out instance))
                 {
                     Data.Seek(entry.Offset);
                     instance = new FST<long>((DataInput)Data, Lucene.Net.Util.Fst.PositiveIntOutputs.Singleton);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/0a03242e/src/Lucene.Net.Core/Search/LiveFieldValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/LiveFieldValues.cs b/src/Lucene.Net.Core/Search/LiveFieldValues.cs
index a46e1f1..1e3920d 100644
--- a/src/Lucene.Net.Core/Search/LiveFieldValues.cs
+++ b/src/Lucene.Net.Core/Search/LiveFieldValues.cs
@@ -111,7 +111,8 @@ namespace Lucene.Net.Search
         public virtual T Get(string id)
         {
             // First try to get the "live" value:
-            T value = Current[id];
+            T value;
+            Current.TryGetValue(id, out value);
             if ((object)value == (object)MissingValue)
             {
                 // Deleted but the deletion is not yet reflected in
@@ -124,7 +125,7 @@ namespace Lucene.Net.Search
             }
             else
             {
-                value = Old[id];
+                Old.TryGetValue(id, out value);
                 if ((object)value == (object)MissingValue)
                 {
                     // Deleted but the deletion is not yet reflected in


Mime
View raw message