lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [21/26] lucenenet git commit: Lucene.Net.Misc.Document.LazyDocument: Slight performance optimization and added TODOs
Date Wed, 08 Mar 2017 18:23:57 GMT
Lucene.Net.Misc.Document.LazyDocument: Slight performance optimization and added TODOs


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

Branch: refs/heads/api-work
Commit: edd30a5f94af8a0f6efd6c74259b61d6bcf1ed1f
Parents: 5298511
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Wed Mar 8 22:45:34 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Wed Mar 8 22:45:34 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Misc/Document/LazyDocument.cs | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/edd30a5f/src/Lucene.Net.Misc/Document/LazyDocument.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Misc/Document/LazyDocument.cs b/src/Lucene.Net.Misc/Document/LazyDocument.cs
index d212176..0a9c3d3 100644
--- a/src/Lucene.Net.Misc/Document/LazyDocument.cs
+++ b/src/Lucene.Net.Misc/Document/LazyDocument.cs
@@ -65,8 +65,8 @@ namespace Lucene.Net.Documents
         public virtual IIndexableField GetField(FieldInfo fieldInfo)
         {
             fieldNames.Add(fieldInfo.Name);
-            IList<LazyField> values = fields.ContainsKey(fieldInfo.Number) ? fields[fieldInfo.Number]
: null;
-            if (null == values)
+            IList<LazyField> values;
+            if (!fields.TryGetValue(fieldInfo.Number, out values) || null == values)
             {
                 values = new List<LazyField>();
                 fields[fieldInfo.Number] = values;
@@ -90,7 +90,7 @@ namespace Lucene.Net.Documents
         /// non-private for test only access
         /// @lucene.internal 
         /// </summary>
-        internal virtual Document Document
+        internal virtual Document Document // LUCENENET TODO: Make GetDocument()
         {
             get
             {
@@ -117,10 +117,12 @@ namespace Lucene.Net.Documents
         {
             Document d = Document;
 
-            IList<LazyField> lazyValues = fields[fieldNum];
+            IList<LazyField> lazyValues;
+            fields.TryGetValue(fieldNum, out lazyValues);
             IIndexableField[] realValues = d.GetFields(name);
 
-            Debug.Assert(realValues.Length <= lazyValues.Count, "More lazy values then
real values for field: " + name);
+            Debug.Assert(realValues.Length <= lazyValues.Count, 
+                "More lazy values then real values for field: " + name);
 
             for (int i = 0; i < lazyValues.Count; i++)
             {
@@ -160,7 +162,7 @@ namespace Lucene.Net.Documents
                 get { return null != realValue; }
             }
 
-            internal virtual IIndexableField RealValue
+            internal virtual IIndexableField RealValue // LUCENENET TODO: Make GetRealValue()
             {
                 get
                 {


Mime
View raw message