lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [4/9] lucenenet git commit: Lucene.Net.Tests.Memory.Index.Memory.MemoryIndexTest: Changed locale of QueryParser to invariant to ensure the ambient culture doesn't affect the result.
Date Tue, 21 Mar 2017 21:25:56 GMT
Lucene.Net.Tests.Memory.Index.Memory.MemoryIndexTest: Changed locale of QueryParser to invariant
to ensure the ambient culture doesn't affect the result.


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

Branch: refs/heads/api-work
Commit: e8bf5491fc571c4b2349d5ff998e191f58a5d9c2
Parents: 85bcff3
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Tue Mar 21 18:40:41 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Tue Mar 21 18:40:41 2017 +0700

----------------------------------------------------------------------
 .../Index/Memory/MemoryIndexTest.cs                      | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/e8bf5491/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs b/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs
index 78439ff..9475d31 100644
--- a/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs
+++ b/src/Lucene.Net.Tests.Memory/Index/Memory/MemoryIndexTest.cs
@@ -2,8 +2,6 @@
 using Lucene.Net.Analysis.TokenAttributes;
 using Lucene.Net.Codecs.Lucene41;
 using Lucene.Net.Documents;
-using Lucene.Net.Index;
-using Lucene.Net.Index.Memory;
 using Lucene.Net.QueryParsers.Classic;
 using Lucene.Net.Search;
 using Lucene.Net.Search.Spans;
@@ -13,6 +11,7 @@ using Lucene.Net.Util;
 using NUnit.Framework;
 using System;
 using System.Collections.Generic;
+using System.Globalization;
 using System.IO;
 using System.Text;
 
@@ -210,11 +209,17 @@ namespace Lucene.Net.Index.Memory
             IndexReader reader = DirectoryReader.Open(ramdir);
             IndexSearcher ram = NewSearcher(reader);
             IndexSearcher mem = memory.CreateSearcher();
-            QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, "foo", analyzer);
+            QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, "foo", analyzer)
+            {
+                // LUCENENET specific - to avoid random failures, set the culture
+                // of the QueryParser to invariant
+                Locale = CultureInfo.InvariantCulture
+            };
             foreach (string query in queries)
             {
                 TopDocs ramDocs = ram.Search(qp.Parse(query), 1);
                 TopDocs memDocs = mem.Search(qp.Parse(query), 1);
+
                 assertEquals(query, ramDocs.TotalHits, memDocs.TotalHits);
             }
             reader.Dispose();


Mime
View raw message