lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [20/50] [abbrv] lucenenet git commit: Fixed issue in Suggest.Search.TestSpellChecker with ConcurrentBag list being built in the reverse order than the items are added.
Date Sun, 02 Oct 2016 14:35:38 GMT
Fixed issue in Suggest.Search.TestSpellChecker with ConcurrentBag list being built in the reverse
order than the items are added.


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

Branch: refs/heads/master
Commit: 31d6f35c4cc666497bd3084870098da7ae95cc1f
Parents: fab36bc
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Fri Sep 16 04:45:54 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Sun Oct 2 17:44:34 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/31d6f35c/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs b/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs
index 346d1ae..48385b4 100644
--- a/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs
+++ b/src/Lucene.Net.Tests.Suggest/Spell/TestSpellChecker.cs
@@ -9,6 +9,7 @@ using System;
 using System.Collections.Concurrent;
 using System.Collections.Generic;
 using System.Globalization;
+using System.Linq;
 using System.Threading;
 
 namespace Lucene.Net.Search.Spell
@@ -519,7 +520,13 @@ namespace Lucene.Net.Search.Spell
         private void AssertLastSearcherOpen(int numSearchers)
         {
             assertEquals(numSearchers, searchers.Count);
-            IndexSearcher[] searcherArray = searchers.ToArray();
+
+            // LUCENENET NOTE: The ConcurrentBag.Add() method adds each item to the
+            // beginning of the list, so we end up with a reverse order array.
+            // We can correct that here, since this is the only part of the
+            // test that cares about the order.
+            IndexSearcher[] searcherArray = searchers.Reverse().ToArray();
+
             for (int i = 0; i < searcherArray.Length; i++)
             {
                 if (i == searcherArray.Length - 1)


Mime
View raw message