[
https://issues.apache.org/jira/browse/LUCENE-8664?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16755016#comment-16755016
]
Luca Cavanna commented on LUCENE-8664:
--------------------------------------
I am not using TotalHits in a map. I would benefit from the equals method for
comparisons in tests. For instance in Elasticsearch we return the lucene
TotalHits to users as part of bigger objects that have their own equals method.
We end up wrapping TotalHits into another internal class that has its own
equals/hashcode (among others). Having equals/hashcode built-in into lucene
would remove the need for a wrapper class, as well as making equality
comparisons a one-liner, especially when comparing multiple instances of
objects holding TotalHits. This is a minor thing obviously, but I did not think
it would be a bug to consider two different TotalHits instances that have same
value and relation equal? I was chatting to [~jim.ferenczi] about this and we
thought we should propose adding this to Lucene. Happy to close this if you
think it should not be done.
> Add equals/hashcode to TotalHits
> --------------------------------
>
> Key: LUCENE-8664
> URL: https://issues.apache.org/jira/browse/LUCENE-8664
> Project: Lucene - Core
> Issue Type: Improvement
> Reporter: Luca Cavanna
> Priority: Minor
>
> I think it would be convenient to add equals/hashcode methods to the
> TotalHits class. I opened a PR here:
> [https://github.com/apache/lucene-solr/pull/552] .
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]