lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [09/16] lucenenet git commit: BUG: Lucene.Net.Tests.Search.TestSearchAfter: Fixed supportsDocValues execution order so it happens after our test environment sets up the default codec
Date Sat, 11 Mar 2017 05:53:02 GMT
BUG: Lucene.Net.Tests.Search.TestSearchAfter: Fixed supportsDocValues execution order so it
happens after our test environment sets up the default codec


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

Branch: refs/heads/api-work
Commit: aacb913b20b89f005daf07eebf7993b4148b321c
Parents: 229d026
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Fri Mar 10 20:09:52 2017 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Fri Mar 10 20:09:52 2017 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests/Search/TestSearchAfter.cs | 24 +++++++++++++++++----
 1 file changed, 20 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/aacb913b/src/Lucene.Net.Tests/Search/TestSearchAfter.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests/Search/TestSearchAfter.cs b/src/Lucene.Net.Tests/Search/TestSearchAfter.cs
index 286eb1b..cf9aa8a 100644
--- a/src/Lucene.Net.Tests/Search/TestSearchAfter.cs
+++ b/src/Lucene.Net.Tests/Search/TestSearchAfter.cs
@@ -60,7 +60,8 @@ namespace Lucene.Net.Search
         private IndexReader Reader;
         private IndexSearcher Searcher;
 
-        internal bool SupportsDocValues = Codec.Default.Name.Equals("Lucene3x") == false;
+        // LUCENENET specific - need to execute this AFTER the base setup, or it won't be
right
+        //internal bool supportsDocValues = Codec.Default.Name.Equals("Lucene3x") == false;
         private int Iter;
         private IList<SortField> AllSortFields;
 
@@ -69,6 +70,10 @@ namespace Lucene.Net.Search
         {
             base.SetUp();
 
+            // LUCENENET specific: Moved this logic here to ensure that it is executed
+            // after the class is setup - a field is way to early to execute this.
+            bool supportsDocValues = Codec.Default.Name.Equals("Lucene3x") == false;
+
             AllSortFields = new List<SortField>(Arrays.AsList(new SortField[] {
 #pragma warning disable 612,618
                 new SortField("byte", SortFieldType.BYTE, false),
@@ -94,9 +99,20 @@ namespace Lucene.Net.Search
                 SortField.FIELD_DOC
             }));
 
-            if (SupportsDocValues)
+            if (supportsDocValues)
             {
-                AllSortFields.AddRange(Arrays.AsList(new SortField[] { new SortField("intdocvalues",
SortFieldType.INT32, false), new SortField("floatdocvalues", SortFieldType.SINGLE, false),
new SortField("sortedbytesdocvalues", SortFieldType.STRING, false), new SortField("sortedbytesdocvaluesval",
SortFieldType.STRING_VAL, false), new SortField("straightbytesdocvalues", SortFieldType.STRING_VAL,
false), new SortField("intdocvalues", SortFieldType.INT32, true), new SortField("floatdocvalues",
SortFieldType.SINGLE, true), new SortField("sortedbytesdocvalues", SortFieldType.STRING, true),
new SortField("sortedbytesdocvaluesval", SortFieldType.STRING_VAL, true), new SortField("straightbytesdocvalues",
SortFieldType.STRING_VAL, true) }));
+                AllSortFields.AddRange(Arrays.AsList(new SortField[] {
+                    new SortField("intdocvalues", SortFieldType.INT32, false),
+                    new SortField("floatdocvalues", SortFieldType.SINGLE, false),
+                    new SortField("sortedbytesdocvalues", SortFieldType.STRING, false),
+                    new SortField("sortedbytesdocvaluesval", SortFieldType.STRING_VAL, false),
+                    new SortField("straightbytesdocvalues", SortFieldType.STRING_VAL, false),
+                    new SortField("intdocvalues", SortFieldType.INT32, true),
+                    new SortField("floatdocvalues", SortFieldType.SINGLE, true),
+                    new SortField("sortedbytesdocvalues", SortFieldType.STRING, true),
+                    new SortField("sortedbytesdocvaluesval", SortFieldType.STRING_VAL, true),
+                    new SortField("straightbytesdocvalues", SortFieldType.STRING_VAL, true)
+                }));
             }
 
             // Also test missing first / last for the "string" sorts:
@@ -164,7 +180,7 @@ namespace Lucene.Net.Search
                 fields.Add(NewStringField("bytesval", TestUtil.RandomRealisticUnicodeString(Random()),
Field.Store.NO));
                 fields.Add(new DoubleField("double", Random().NextDouble(), Field.Store.NO));
 
-                if (SupportsDocValues)
+                if (supportsDocValues)
                 {
                     fields.Add(new NumericDocValuesField("intdocvalues", Random().Next()));
                     fields.Add(new SingleDocValuesField("floatdocvalues", (float)Random().NextDouble()));


Mime
View raw message