lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lai...@apache.org
Subject lucenenet git commit: more debugging
Date Sat, 23 May 2015 02:33:00 GMT
Repository: lucenenet
Updated Branches:
  refs/heads/failingtests b10af1143 -> abcfdf231


more debugging


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

Branch: refs/heads/failingtests
Commit: abcfdf23163c513a748e188053a4f2999f001d09
Parents: b10af11
Author: Laimonas Simutis <laimis@gmail.com>
Authored: Fri May 22 22:32:37 2015 -0400
Committer: Laimonas Simutis <laimis@gmail.com>
Committed: Fri May 22 22:32:37 2015 -0400

----------------------------------------------------------------------
 src/Lucene.Net.Core/Search/HitQueue.cs               |  9 +++++++--
 src/Lucene.Net.Core/Search/TermScorer.cs             | 12 +++++++++---
 src/Lucene.Net.Tests/core/Search/TestTopDocsMerge.cs |  5 +++--
 3 files changed, 19 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/abcfdf23/src/Lucene.Net.Core/Search/HitQueue.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/HitQueue.cs b/src/Lucene.Net.Core/Search/HitQueue.cs
index c9ab5dc..6ba24fe 100644
--- a/src/Lucene.Net.Core/Search/HitQueue.cs
+++ b/src/Lucene.Net.Core/Search/HitQueue.cs
@@ -77,14 +77,19 @@ namespace Lucene.Net.Search
 
         public override bool LessThan(ScoreDoc hitA, ScoreDoc hitB)
         {
+            bool result;
             if (hitA.Score == hitB.Score)
             {
-                return hitA.Doc > hitB.Doc;
+                result = hitA.Doc > hitB.Doc;
             }
             else
             {
-                return hitA.Score < hitB.Score;
+                result = hitA.Score < hitB.Score;
             }
+
+            OutputCollector.AppendLine("Comparing " + hitA + " to " + hitB + "; result "
+ result);
+
+            return result;
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/abcfdf23/src/Lucene.Net.Core/Search/TermScorer.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Core/Search/TermScorer.cs b/src/Lucene.Net.Core/Search/TermScorer.cs
index 0796198..8b13faf 100644
--- a/src/Lucene.Net.Core/Search/TermScorer.cs
+++ b/src/Lucene.Net.Core/Search/TermScorer.cs
@@ -64,9 +64,7 @@ namespace Lucene.Net.Search
         /// <returns> the document matching the query or NO_MORE_DOCS if there are
no more documents. </returns>
         public override int NextDoc()
         {
-            var docId = DocsEnum.NextDoc();
-            OutputCollector.Current.AppendLine(this.DocsEnum.GetType().ToString() + " - "
+ docId);
-            return docId;
+            return DocsEnum.NextDoc();
         }
 
         public override float Score()
@@ -109,5 +107,13 @@ namespace Lucene.Net.Search
         {
             Current = instance;
         }
+
+        public static void AppendLine(string s)
+        {
+            if (Current != null)
+            {
+                Current.AppendLine(s);
+            }
+        }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/abcfdf23/src/Lucene.Net.Tests/core/Search/TestTopDocsMerge.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/core/Search/TestTopDocsMerge.cs b/src/Lucene.Net.Tests/core/Search/TestTopDocsMerge.cs
index a41da69..6e8ee6e 100644
--- a/src/Lucene.Net.Tests/core/Search/TestTopDocsMerge.cs
+++ b/src/Lucene.Net.Tests/core/Search/TestTopDocsMerge.cs
@@ -191,8 +191,7 @@ namespace Lucene.Net.Search
             for (int iter = 0; iter < 1000 * RANDOM_MULTIPLIER; iter++)
             {
                 var outputCollector = new StringBuilder();
-                OutputCollector.Init(outputCollector);
-
+                
                 // TODO: custom FieldComp...
                 Query query = new TermQuery(new Term("text", tokens[Random().Next(tokens.Length)]));
 
@@ -250,7 +249,9 @@ namespace Lucene.Net.Search
                     }
                     else
                     {
+                        OutputCollector.Init(outputCollector);
                         topHits = searcher.Search(query, numHits);
+                        OutputCollector.Init(null);
                     }
                 }
                 else


Mime
View raw message