lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [21/50] [abbrv] lucenenet git commit: Fixed infinite recursion bug in Suggest.Jaspell.JaspellTernarySearchTrie.TSTNote.GetSizeInBytes()
Date Sun, 02 Oct 2016 14:35:39 GMT
Fixed infinite recursion bug in Suggest.Jaspell.JaspellTernarySearchTrie.TSTNote.GetSizeInBytes()


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

Branch: refs/heads/master
Commit: 08bc7d4dd32177137a9d059a9a91e3190c9427da
Parents: 31d6f35
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Fri Sep 16 18:45:44 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Oct 2 17:44:36 2016 +0700

----------------------------------------------------------------------
 .../Suggest/Jaspell/JaspellTernarySearchTrie.cs           | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/08bc7d4d/src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellTernarySearchTrie.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellTernarySearchTrie.cs b/src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellTernarySearchTrie.cs
index d0814c6..7bc7995 100644
--- a/src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellTernarySearchTrie.cs
+++ b/src/Lucene.Net.Suggest/Suggest/Jaspell/JaspellTernarySearchTrie.cs
@@ -105,14 +105,20 @@ namespace Lucene.Net.Search.Suggest.Jaspell
                 long mem = RamUsageEstimator.ShallowSizeOf(this) + RamUsageEstimator.ShallowSizeOf(relatives);
                 foreach (TSTNode node in relatives)
                 {
-                    if (node != null)
+                    // LUCENENET NOTE: Going with the summary of this method, which says
it should not
+                    // include the parent node. When we include the parent node, it results
in overflowing
+                    // the thread stack because we have infinite recursion.
+                    //
+                    // However, in version 6.2 of Lucene (latest) it mentions we should also
estimate the parent node.
+                    // https://github.com/apache/lucene-solr/blob/764d0f19151dbff6f5fcd9fc4b2682cf934590c5/lucene/suggest/src/java/org/apache/lucene/search/suggest/jaspell/JaspellTernarySearchTrie.java#L104
+                    // Not sure what the reason for that is, but it seems like a recipe for
innaccuracy.
+                    if (node != null && node != relatives[PARENT])
                     {
                         mem += node.GetSizeInBytes();
                     }
                 }
                 return mem;
             }
-
         }
 
         /// <summary>


Mime
View raw message