mikemccand commented on code in PR #13740: URL: https://github.com/apache/lucene/pull/13740#discussion_r1770557016
########## lucene/facet/src/java/org/apache/lucene/facet/LabelAndValue.java: ########## @@ -52,11 +41,81 @@ public boolean equals(Object _other) { return false; } LabelAndValue other = (LabelAndValue) _other; - return label.equals(other.label) && value.equals(other.value); + if (label.equals(other.label) == false) { + return false; + } + // value and other.value could be Number and ValueAndCount. + // We need the equals in ValueAndCount to be called. + if (value instanceof ValueAndCount) { + return value.equals(other.value); + } + return other.value.equals(value); } @Override public int hashCode() { return label.hashCode() + 1439 * value.hashCode(); } + + /** + * Is a {@link Number} while holding a {@link Number} and a count. Meant as a value for {@link + * LabelAndValue}. + */ + public static class ValueAndCount extends Number { Review Comment: Maybe pull this out into its own source file? -- 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