LUCENE-9902 Minor fixes to the faceting API (#62)

This commit is contained in:
Gautam Worah 2021-04-06 11:50:23 -07:00 committed by GitHub
parent be94a667f2
commit efeea0b8ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 3 deletions

View File

@ -290,7 +290,10 @@ Other
API Changes
---------------------
(No changes)
* LUCENE-9902: Change the getValue method from IntTaxonomyFacets to be protected instead of private.
Users can now access the count of an ordinal directly without constructing an extra FacetLabel.
Also use variable length arguments for the getOrdinal call in TaxonomyReader. (Gautam Worah)
New Features
---------------------

View File

@ -88,7 +88,8 @@ public abstract class IntTaxonomyFacets extends TaxonomyFacets {
}
}
private int getValue(int ordinal) {
/** Get the count for this ordinal. */
protected int getValue(int ordinal) {
if (sparseValues != null) {
return sparseValues.get(ordinal);
} else {

View File

@ -202,7 +202,7 @@ public abstract class TaxonomyReader implements Closeable {
public abstract int getOrdinal(FacetLabel categoryPath) throws IOException;
/** Returns ordinal for the dim + path. */
public int getOrdinal(String dim, String[] path) throws IOException {
public int getOrdinal(String dim, String... path) throws IOException {
String[] fullPath = new String[path.length + 1];
fullPath[0] = dim;
System.arraycopy(path, 0, fullPath, 1, path.length);