stefanvodita opened a new pull request, #13414:
URL: https://github.com/apache/lucene/pull/13414

   Taxonomy facets always have counts since #12966. We add a `count` field to 
`LabelAndValue` so that users can retrieve those counts.
   
   #### What I like about this approach:
   1. It's backwards compatible, so we can offer this in 9x.
   2. It's simple and straightforward. Doing something smarter (discussed 
below) will require touching a lot of code and lead to more complicated usage 
patterns.
   
   #### What I don't like about this approach:
   1. The count will be stored in the `LabelAndValue` twice for facets that 
were doing count (e.g. `FastTaxonomyFacetCounts`), once as the `value` and once 
as the `count`.
   3. `new LabelAndValue("label", 1).equals(new LabelAndValue("label", 1, 1) == 
true` i.e. the `count` does not factor into equality of `LabelAndValue`. This 
is necessary to maintain backwards compatibility.
   
   #### What else could we do:
   1. `LabelAndValue.value` is a `Number`. We can extend `Number` to put 
anything we want into `value`, e.g. `ValueAndCount` (see the first commit in 
this PR as example). We can start returning `ValueAndCount` instead of 
something the user might have assumed can be cast to `Integer`, so this would 
not be backwards compatible.
   2. Make `LabelAndValue` parametrised, so the user can specify what type the 
`value` is. I think we'd have to parametrise `FacetResult` as well in that 
case, which makes the number of changes explode. It's a big API change as well.
   
   I propose we go ahead with this PR for now and then follow-up with one of 
the options above (or another if anyone has ideas) for 10x.


-- 
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

Reply via email to