gsmiller commented on a change in pull request #747: URL: https://github.com/apache/lucene/pull/747#discussion_r831477355
########## File path: lucene/facet/src/java/org/apache/lucene/facet/sortedset/SortedSetDocValuesFacetCounts.java ########## @@ -414,4 +505,101 @@ public int compare(FacetResult a, FacetResult b) { return results; } + + @Override + public List<FacetResult> getTopDims(int topNDims, int topNChildren) throws IOException { + // Creates priority queue to store top dimensions and sort by their aggregated values/hits and + // string values. + PriorityQueue<SortedSetDocValuesDimValueResult> pq = + new PriorityQueue<>(topNDims) { + @Override + protected boolean lessThan( + SortedSetDocValuesDimValueResult a, SortedSetDocValuesDimValueResult b) { + if (a.value.intValue() > b.value.intValue()) { + return false; + } else if (a.value.intValue() < b.value.intValue()) { + return true; + } else { + return a.dim.compareTo(b.dim) > 0; + } + } + }; + + HashMap<String, SortedSetDocValuesChildOrdsResult> cacheChildOrdsResult = new HashMap<>(); Review comment: Ugh, sorry I meant `IntObjectHashMap`. The benefit I was hoping for would be not needing to resolve the dimension strings but after I took a closer look, we've already got the strings in `state.getDims()`. So feel free to ignore this. I think what you're doing here is fine. Thanks and sorry if I caused confusion! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org