You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucenenet.apache.org by ni...@apache.org on 2017/01/26 11:12:24 UTC

[11/11] lucenenet git commit: Lucene.Net.Expressions.ScoreFunctionValues: Added try catch block from original implementation because it could potentially fix issues

Lucene.Net.Expressions.ScoreFunctionValues: Added try catch block from original implementation because it could potentially fix issues


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

Branch: refs/heads/api-work
Commit: 8174a11cc3141156a6fef64910541c9fe23a95d9
Parents: 90d6473
Author: Shad Storhaug <sh...@shadstorhaug.com>
Authored: Thu Jan 26 17:05:34 2017 +0700
Committer: Shad Storhaug <sh...@shadstorhaug.com>
Committed: Thu Jan 26 17:05:34 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Expressions/ScoreFunctionValues.cs | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/8174a11c/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Expressions/ScoreFunctionValues.cs b/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
index 0dfd838..d87c16f 100644
--- a/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
+++ b/src/Lucene.Net.Expressions/ScoreFunctionValues.cs
@@ -3,6 +3,7 @@ using Lucene.Net.Queries.Function.DocValues;
 using Lucene.Net.Search;
 using System;
 using System.Diagnostics;
+using System.IO;
 
 namespace Lucene.Net.Expressions
 {
@@ -39,11 +40,15 @@ namespace Lucene.Net.Expressions
 
         public override double DoubleVal(int document)
         {
-            // LUCENENET TODO: Possible Bug: Put in try-catch and rethrow "RuntimeException"
-            Debug.Assert(document == scorer.DocID);
-            var score = scorer.GetScore();
-            Console.WriteLine("Score = {0}",score);
-            return score;
+            try
+            {
+                Debug.Assert(document == scorer.DocID);
+                return scorer.GetScore();
+            }
+            catch (IOException exception)
+            {
+                throw new Exception(exception.Message, exception);
+            }
         }
     }
 }