lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [08/46] lucenenet git commit: Fixed sorting bugs in Facet.FacetTestCase. Need to sort the list that was passed into the method, not create a new one.
Date Tue, 04 Oct 2016 20:01:38 GMT
Fixed sorting bugs in Facet.FacetTestCase. Need to sort the list that was passed into the method,
not create a new one.


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

Branch: refs/heads/master
Commit: 44f7d9c833ae4695bc643041d6e2c9083a721fb6
Parents: 4b87de0
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sat Sep 24 20:09:24 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Mon Oct 3 23:30:49 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Tests.Facet/FacetTestCase.cs             | 12 ++++--------
 .../SortedSet/TestSortedSetDocValuesFacets.cs           |  6 +++---
 .../Taxonomy/TestTaxonomyFacetCounts.cs                 |  4 ++--
 .../Taxonomy/TestTaxonomyFacetSumValueSource.cs         |  4 ++--
 4 files changed, 11 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/44f7d9c8/src/Lucene.Net.Tests.Facet/FacetTestCase.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/FacetTestCase.cs b/src/Lucene.Net.Tests.Facet/FacetTestCase.cs
index 977d13b..0c71f32 100644
--- a/src/Lucene.Net.Tests.Facet/FacetTestCase.cs
+++ b/src/Lucene.Net.Tests.Facet/FacetTestCase.cs
@@ -182,11 +182,9 @@ namespace Lucene.Net.Facet
             }
         }
 
-        protected internal virtual void SortLabelValues(IList<LabelAndValue> labelValues)
+        protected internal virtual void SortLabelValues(List<LabelAndValue> labelValues)
         {
-            var resArray = labelValues.ToArray();
-            Array.Sort(resArray,new ComparatorAnonymousInnerClassHelper2(this));
-            labelValues = resArray.ToList();
+            labelValues.Sort(new ComparatorAnonymousInnerClassHelper2(this));
         }
 
         private class ComparatorAnonymousInnerClassHelper2 : IComparer<LabelAndValue>
@@ -215,11 +213,9 @@ namespace Lucene.Net.Facet
             }
         }
 
-        protected internal virtual void SortFacetResults(IList<FacetResult> results)
+        protected internal virtual void SortFacetResults(List<FacetResult> results)
         {
-            var resArray = results.ToArray();
-            Array.Sort(resArray, new ComparatorAnonymousInnerClassHelper3(this));
-            results = resArray.ToList();
+            results.Sort(new ComparatorAnonymousInnerClassHelper3(this));
         }
 
         private class ComparatorAnonymousInnerClassHelper3 : IComparer<FacetResult>

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/44f7d9c8/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs b/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs
index 75cf9d3..fe385d1 100644
--- a/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs
+++ b/src/Lucene.Net.Tests.Facet/SortedSet/TestSortedSetDocValuesFacets.cs
@@ -359,10 +359,10 @@ namespace Lucene.Net.Facet.SortedSet
                     }
                 }
 
-                IList<FacetResult> expected = new List<FacetResult>();
+                List<FacetResult> expected = new List<FacetResult>();
                 for (int i = 0; i < numDims; i++)
                 {
-                    IList<LabelAndValue> labelValues = new List<LabelAndValue>();
+                    List<LabelAndValue> labelValues = new List<LabelAndValue>();
                     int totCount = 0;
                     foreach (KeyValuePair<string, int?> ent in expectedCounts[i])
                     {
@@ -384,7 +384,7 @@ namespace Lucene.Net.Facet.SortedSet
                 // Messy: fixup ties
                 //sortTies(actual);
 
-                Assert.AreEqual(expected, actual);
+                CollectionAssert.AreEqual(expected, actual);
             }
 
             IOUtils.Close(w, searcher.IndexReader, indexDir, taxoDir);

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/44f7d9c8/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
index 72390e2..e4ddc51 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetCounts.cs
@@ -816,10 +816,10 @@ namespace Lucene.Net.Facet.Taxonomy
                     }
                 }
 
-                IList<FacetResult> expected = new List<FacetResult>();
+                List<FacetResult> expected = new List<FacetResult>();
                 for (int i = 0; i < numDims; i++)
                 {
-                    IList<LabelAndValue> labelValues = new List<LabelAndValue>();
+                    List<LabelAndValue> labelValues = new List<LabelAndValue>();
                     int totCount = 0;
                     foreach (KeyValuePair<string, int?> ent in expectedCounts[i])
                     {

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/44f7d9c8/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs
index e05daa9..d8edbb5 100644
--- a/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs
+++ b/src/Lucene.Net.Tests.Facet/Taxonomy/TestTaxonomyFacetSumValueSource.cs
@@ -569,10 +569,10 @@ namespace Lucene.Net.Facet.Taxonomy
                     }
                 }
 
-                IList<FacetResult> expected = new List<FacetResult>();
+                List<FacetResult> expected = new List<FacetResult>();
                 for (int i = 0; i < numDims; i++)
                 {
-                    IList<LabelAndValue> labelValues = new List<LabelAndValue>();
+                    List<LabelAndValue> labelValues = new List<LabelAndValue>();
                     float totValue = 0;
                     foreach (KeyValuePair<string, float?> ent in expectedValues[i])
                     {


Mime
View raw message