lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From synhers...@apache.org
Subject [24/46] lucenenet git commit: Facets: Return List<T> rather than IList<T> to prevent having to do too many O(n) operations on the results.
Date Tue, 04 Oct 2016 20:01:54 GMT
Facets: Return List<T> rather than IList<T> to prevent having to do too many O(n)
operations on the results.


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

Branch: refs/heads/master
Commit: f50f913d565ff8d1e90285c8a8af239dbae313f2
Parents: 9912999
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Sun Sep 25 15:10:27 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Mon Oct 3 23:31:29 2016 +0700

----------------------------------------------------------------------
 src/Lucene.Net.Facet/Facets.cs                                 | 2 +-
 src/Lucene.Net.Facet/MultiFacets.cs                            | 4 ++--
 src/Lucene.Net.Facet/Range/RangeFacetCounts.cs                 | 4 ++--
 .../SortedSet/SortedSetDocValuesFacetCounts.cs                 | 6 +++---
 src/Lucene.Net.Facet/Taxonomy/TaxonomyFacets.cs                | 6 +++---
 5 files changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f50f913d/src/Lucene.Net.Facet/Facets.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Facet/Facets.cs b/src/Lucene.Net.Facet/Facets.cs
index 405d1b3..ce17c15 100644
--- a/src/Lucene.Net.Facet/Facets.cs
+++ b/src/Lucene.Net.Facet/Facets.cs
@@ -53,6 +53,6 @@ namespace Lucene.Net.Facet
         ///  different dimensions were indexed, for example
         ///  depending on the type of document. 
         /// </summary>
-        public abstract IList<FacetResult> GetAllDims(int topN);
+        public abstract List<FacetResult> GetAllDims(int topN);
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f50f913d/src/Lucene.Net.Facet/MultiFacets.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Facet/MultiFacets.cs b/src/Lucene.Net.Facet/MultiFacets.cs
index 051de44..79bb077 100644
--- a/src/Lucene.Net.Facet/MultiFacets.cs
+++ b/src/Lucene.Net.Facet/MultiFacets.cs
@@ -67,10 +67,10 @@ namespace Lucene.Net.Facet
             return facets.GetSpecificValue(dim, path);
         }
 
-        public override IList<FacetResult> GetAllDims(int topN)
+        public override List<FacetResult> GetAllDims(int topN)
         {
 
-            IList<FacetResult> results = new List<FacetResult>();
+            List<FacetResult> results = new List<FacetResult>();
 
             // First add the specific dim's facets:
             foreach (KeyValuePair<string, Facets> ent in dimToFacets)

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f50f913d/src/Lucene.Net.Facet/Range/RangeFacetCounts.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Facet/Range/RangeFacetCounts.cs b/src/Lucene.Net.Facet/Range/RangeFacetCounts.cs
index e051712..943f4e1 100644
--- a/src/Lucene.Net.Facet/Range/RangeFacetCounts.cs
+++ b/src/Lucene.Net.Facet/Range/RangeFacetCounts.cs
@@ -86,9 +86,9 @@ namespace Lucene.Net.Facet.Range
             throw new System.NotSupportedException();
         }
 
-        public override IList<FacetResult> GetAllDims(int topN)
+        public override List<FacetResult> GetAllDims(int topN)
         {
-            return new[] { GetTopChildren(topN, null) };
+            return new List<FacetResult> { GetTopChildren(topN, null) };
         }
     }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f50f913d/src/Lucene.Net.Facet/SortedSet/SortedSetDocValuesFacetCounts.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Facet/SortedSet/SortedSetDocValuesFacetCounts.cs b/src/Lucene.Net.Facet/SortedSet/SortedSetDocValuesFacetCounts.cs
index 95ee9d1..b32d430 100644
--- a/src/Lucene.Net.Facet/SortedSet/SortedSetDocValuesFacetCounts.cs
+++ b/src/Lucene.Net.Facet/SortedSet/SortedSetDocValuesFacetCounts.cs
@@ -291,7 +291,7 @@ namespace Lucene.Net.Facet.SortedSet
             return counts[ord];
         }
 
-        public override IList<FacetResult> GetAllDims(int topN)
+        public override List<FacetResult> GetAllDims(int topN)
         {
             IList<FacetResult> results = new List<FacetResult>();
             foreach (KeyValuePair<string, OrdRange> ent in state.PrefixToOrdRange)
@@ -303,9 +303,9 @@ namespace Lucene.Net.Facet.SortedSet
                 }
             }
 
-            var resultArray = results.ToArray();
+            var resultArray = results.ToList();
             // Sort by highest count:
-            Array.Sort(resultArray, new ComparatorAnonymousInnerClassHelper(this));
+            resultArray.Sort(new ComparatorAnonymousInnerClassHelper(this));
             return resultArray;
         }
 

http://git-wip-us.apache.org/repos/asf/lucenenet/blob/f50f913d/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacets.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacets.cs b/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacets.cs
index 1a53994..51a073f 100644
--- a/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacets.cs
+++ b/src/Lucene.Net.Facet/Taxonomy/TaxonomyFacets.cs
@@ -105,7 +105,7 @@ namespace Lucene.Net.Facet.Taxonomy
             return dimConfig;
         }
 
-        public override IList<FacetResult> GetAllDims(int topN)
+        public override List<FacetResult> GetAllDims(int topN)
         {
             int ord = children[TaxonomyReader.ROOT_ORDINAL];
             IList<FacetResult> results = new List<FacetResult>();
@@ -125,8 +125,8 @@ namespace Lucene.Net.Facet.Taxonomy
             }
 
             // Sort by highest value, tie break by dim:
-            var resultArray = results.ToArray();
-            Array.Sort(resultArray, BY_VALUE_THEN_DIM);
+            var resultArray = results.ToList();
+            resultArray.Sort(BY_VALUE_THEN_DIM);
             return resultArray;
         }
     }


Mime
View raw message