lucenenet-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nightowl...@apache.org
Subject [37/58] [abbrv] lucenenet git commit: Completed implementation of the Grouping.AbstractGroupFacetCollector using the TreeSet.
Date Thu, 10 Nov 2016 11:47:51 GMT
Completed implementation of the Grouping.AbstractGroupFacetCollector using the TreeSet.


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

Branch: refs/heads/master
Commit: a8f7f42aedd968ae73a4bc1be3b55294ec66521f
Parents: b689479
Author: Shad Storhaug <shad@shadstorhaug.com>
Authored: Thu Oct 27 18:46:13 2016 +0700
Committer: Shad Storhaug <shad@shadstorhaug.com>
Committed: Tue Nov 8 02:24:54 2016 +0700

----------------------------------------------------------------------
 .../AbstractGroupFacetCollector.cs              | 22 ++++++++++----------
 1 file changed, 11 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucenenet/blob/a8f7f42a/src/Lucene.Net.Grouping/AbstractGroupFacetCollector.cs
----------------------------------------------------------------------
diff --git a/src/Lucene.Net.Grouping/AbstractGroupFacetCollector.cs b/src/Lucene.Net.Grouping/AbstractGroupFacetCollector.cs
index 1cc4574..9769871 100644
--- a/src/Lucene.Net.Grouping/AbstractGroupFacetCollector.cs
+++ b/src/Lucene.Net.Grouping/AbstractGroupFacetCollector.cs
@@ -1,4 +1,5 @@
 ´╗┐using Lucene.Net.Search;
+using Lucene.Net.Support;
 using Lucene.Net.Util;
 using System;
 using System.Collections.Generic;
@@ -164,7 +165,7 @@ namespace Lucene.Net.Search.Grouping
             //    };
 
             private readonly int maxSize;
-            private readonly SortedSet<FacetEntry> facetEntries;
+            private readonly TreeSet<FacetEntry> facetEntries;
             private readonly int totalMissingCount;
             private readonly int totalCount;
 
@@ -172,7 +173,7 @@ namespace Lucene.Net.Search.Grouping
 
             public GroupedFacetResult(int size, int minCount, bool orderByCount, int totalCount,
int totalMissingCount)
             {
-                this.facetEntries = new SortedSet<FacetEntry>(orderByCount ? orderByCountAndValue
: orderByValue);
+                this.facetEntries = new TreeSet<FacetEntry>(orderByCount ? orderByCountAndValue
: orderByValue);
                 this.totalMissingCount = totalMissingCount;
                 this.totalCount = totalCount;
                 maxSize = size;
@@ -189,19 +190,18 @@ namespace Lucene.Net.Search.Grouping
                 FacetEntry facetEntry = new FacetEntry(facetValue, count);
                 if (facetEntries.Count == maxSize)
                 {
-                    // LUCENENET TODO: Add the C5.TreeSet to Support?
-                    // LUCENENET TODO: Finish implementation
-                    //if (facetEntries.Higher(facetEntry) == null)
-                    //{
-                    //    return;
-                    //}
-                    facetEntries.Remove(facetEntries.Last());
+                    FacetEntry temp;
+                    if (!facetEntries.TrySuccessor(facetEntry, out temp))
+                    {
+                        return;
+                    }
+                    facetEntries.DeleteMax();
                 }
                 facetEntries.Add(facetEntry);
 
                 if (facetEntries.Count == maxSize)
                 {
-                    currentMin = facetEntries.Last().Count;
+                    currentMin = facetEntries.FindMax().Count;
                 }
             }
 
@@ -359,7 +359,7 @@ namespace Lucene.Net.Search.Grouping
 
         }
 
-        private class SegmentResultPriorityQueue : PriorityQueue<AbstractSegmentResult>
+        private class SegmentResultPriorityQueue : Util.PriorityQueue<AbstractSegmentResult>
         {
             internal SegmentResultPriorityQueue(int maxSize)
                 : base(maxSize)


Mime
View raw message