mirror of https://github.com/apache/lucene.git
LUCENE-9902 Minor fixes to the faceting API (#62)
This commit is contained in:
parent
be94a667f2
commit
efeea0b8ee
|
@ -290,7 +290,10 @@ Other
|
||||||
|
|
||||||
API Changes
|
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
|
New Features
|
||||||
---------------------
|
---------------------
|
||||||
|
|
|
@ -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) {
|
if (sparseValues != null) {
|
||||||
return sparseValues.get(ordinal);
|
return sparseValues.get(ordinal);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -202,7 +202,7 @@ public abstract class TaxonomyReader implements Closeable {
|
||||||
public abstract int getOrdinal(FacetLabel categoryPath) throws IOException;
|
public abstract int getOrdinal(FacetLabel categoryPath) throws IOException;
|
||||||
|
|
||||||
/** Returns ordinal for the dim + path. */
|
/** 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];
|
String[] fullPath = new String[path.length + 1];
|
||||||
fullPath[0] = dim;
|
fullPath[0] = dim;
|
||||||
System.arraycopy(path, 0, fullPath, 1, path.length);
|
System.arraycopy(path, 0, fullPath, 1, path.length);
|
||||||
|
|
Loading…
Reference in New Issue