Skip to content

Apache Lucene open-source search software

LUCENE-10440: Reduce visibility of TaxonomyFacets and FloatTaxonomyFacets (#712)

Greg Miller51797dc7f1be
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 88d516a11d0..cc41cbb2118 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -17,6 +17,9 @@ API Changes
* LUCENE-10400: Remove deprecated dictionary constructors in Kuromoji and Nori (Tomoko Uchida)
+* LUCENE-10440: TaxonomyFacets and FloatTaxonomyFacets have been made pkg-private and only serve
+ as internal implementation details of taxonomy-faceting. (Greg Miller)
+
New Features
---------------------
@@ -93,6 +96,9 @@ API Changes
* LUCENE-10398: Add static method for getting Terms from LeafReader. (Spike Liu)
+* LUCENE-10440: TaxonomyFacets and FloatTaxonomyFacets have been deprecated and are no longer
+ supported extension points for user-created faceting implementations. (Greg Miller)
+
New Features
---------------------
diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/FloatTaxonomyFacets.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/FloatTaxonomyFacets.java
index ec7f307b99c..60edf0f214e 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/FloatTaxonomyFacets.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/FloatTaxonomyFacets.java
@@ -25,22 +25,22 @@ import org.apache.lucene.facet.LabelAndValue;
import org.apache.lucene.facet.TopOrdAndFloatQueue;
/** Base class for all taxonomy-based facets that aggregate to a per-ords float[]. */
-public abstract class FloatTaxonomyFacets extends TaxonomyFacets {
+abstract class FloatTaxonomyFacets extends TaxonomyFacets {
// TODO: also use native hash map for sparse collection, like IntTaxonomyFacets
/** Per-ordinal value. */
- protected final float[] values;
+ final float[] values;
/** Sole constructor. */
- protected FloatTaxonomyFacets(
- String indexFieldName, TaxonomyReader taxoReader, FacetsConfig config) throws IOException {
+ FloatTaxonomyFacets(String indexFieldName, TaxonomyReader taxoReader, FacetsConfig config)
+ throws IOException {
super(indexFieldName, taxoReader, config);
values = new float[taxoReader.getSize()];
}
/** Rolls up any single-valued hierarchical dimensions. */
- protected void rollup() throws IOException {
+ void rollup() throws IOException {
// Rollup any necessary dims:
int[] children = getChildren();
for (Map.Entry<String, DimConfig> ent : config.getDimConfigs().entrySet()) {
diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyFacets.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyFacets.java
index 99a92128d7c..1f4e5cbe789 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyFacets.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyFacets.java
@@ -29,7 +29,7 @@ import org.apache.lucene.facet.FacetsConfig;
import org.apache.lucene.facet.FacetsConfig.DimConfig;
/** Base class for all taxonomy-based facets impls. */
-public abstract class TaxonomyFacets extends Facets {
+abstract class TaxonomyFacets extends Facets {
private static final Comparator<FacetResult> BY_VALUE_THEN_DIM =
new Comparator<FacetResult>() {
@@ -46,13 +46,13 @@ public abstract class TaxonomyFacets extends Facets {
};
/** Index field name provided to the constructor. */
- protected final String indexFieldName;
+ final String indexFieldName;
/** {@code TaxonomyReader} provided to the constructor. */
- protected final TaxonomyReader taxoReader;
+ final TaxonomyReader taxoReader;
/** {@code FacetsConfig} provided to the constructor. */
- protected final FacetsConfig config;
+ final FacetsConfig config;
/** Maps parent ordinal to its child, or -1 if the parent is childless. */
private int[] children;
@@ -61,10 +61,10 @@ public abstract class TaxonomyFacets extends Facets {
private int[] siblings;
/** Maps an ordinal to its parent, or -1 if there is no parent (root node). */
- protected final int[] parents;
+ final int[] parents;
/** Sole constructor. */
- protected TaxonomyFacets(String indexFieldName, TaxonomyReader taxoReader, FacetsConfig config)
+ TaxonomyFacets(String indexFieldName, TaxonomyReader taxoReader, FacetsConfig config)
throws IOException {
this.indexFieldName = indexFieldName;
this.taxoReader = taxoReader;
@@ -76,7 +76,7 @@ public abstract class TaxonomyFacets extends Facets {
* Returns int[] mapping each ordinal to its first child; this is a large array and is computed
* (and then saved) the first time this method is invoked.
*/
- protected int[] getChildren() throws IOException {
+ int[] getChildren() throws IOException {
if (children == null) {
children = taxoReader.getParallelTaxonomyArrays().children();
}
@@ -87,7 +87,7 @@ public abstract class TaxonomyFacets extends Facets {
* Returns int[] mapping each ordinal to its next sibling; this is a large array and is computed
* (and then saved) the first time this method is invoked.
*/
- protected int[] getSiblings() throws IOException {
+ int[] getSiblings() throws IOException {
if (siblings == null) {
siblings = taxoReader.getParallelTaxonomyArrays().siblings();
}
@@ -120,7 +120,7 @@ public abstract class TaxonomyFacets extends Facets {
* @throws IllegalArgumentException if the provided dimension was manually configured, but its
* {@link DimConfig#indexFieldName} does not match {@link #indexFieldName}.
*/
- protected DimConfig verifyDim(String dim) {
+ DimConfig verifyDim(String dim) {
FacetsConfig.DimConfig dimConfig = config.getDimConfig(dim);
if (config.isDimConfigured(dim) == true
&& dimConfig.indexFieldName.equals(indexFieldName) == false) {