mikemccand commented on code in PR #12966: URL: https://github.com/apache/lucene/pull/12966#discussion_r1546497831
########## lucene/facet/src/java/org/apache/lucene/facet/TopOrdAndIntQueue.java: ########## @@ -16,37 +16,42 @@ */ package org.apache.lucene.facet; -import org.apache.lucene.util.PriorityQueue; +/** Keeps highest results, first by largest int value, then tie-break by smallest ord. */ +public class TopOrdAndIntQueue extends TopOrdAndNumberQueue { -/** Keeps highest results, first by largest int value, then tie break by smallest ord. */ -public class TopOrdAndIntQueue extends PriorityQueue<TopOrdAndIntQueue.OrdAndValue> { - - /** Holds a single entry. */ - public static final class OrdAndValue { - - /** Ordinal of the entry. */ - public int ord; + /** Sole constructor. */ + public TopOrdAndIntQueue(int topN) { + super(topN); + } - /** Value associated with the ordinal. */ + /** Holds an ordinal and an int value. */ + public static final class OrdAndInt extends OrdAndValue { + /** The value corresponding to the ordinal is an int. */ public int value; /** Default constructor. */ - public OrdAndValue() {} - } + public OrdAndInt() {} + + @Override + public boolean lessThan(OrdAndValue other) { + OrdAndInt otherOrdAndInt = (OrdAndInt) other; + if (value < otherOrdAndInt.value) { Review Comment: You might use `Integer.compare` here -- not sure if it's actually faster. You'd still need to get the result and check if it's `!= 0` for the tiebreak (which could also be `Integer.compare`). -- 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