You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2021/04/06 18:50:29 UTC
[lucene] branch main updated: LUCENE-9902 Minor fixes to the
faceting API (#62)
This is an automated email from the ASF dual-hosted git repository.
mikemccand pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new efeea0b LUCENE-9902 Minor fixes to the faceting API (#62)
efeea0b is described below
commit efeea0b8ee72ef4cf0f76f129a17b7b8d48f3ed6
Author: Gautam Worah <wo...@gmail.com>
AuthorDate: Tue Apr 6 11:50:23 2021 -0700
LUCENE-9902 Minor fixes to the faceting API (#62)
---
lucene/CHANGES.txt | 5 ++++-
.../src/java/org/apache/lucene/facet/taxonomy/IntTaxonomyFacets.java | 3 ++-
.../src/java/org/apache/lucene/facet/taxonomy/TaxonomyReader.java | 2 +-
3 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 1ab5283..638194b 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -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
---------------------
diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/IntTaxonomyFacets.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/IntTaxonomyFacets.java
index 434becb..7d4e5d6 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/IntTaxonomyFacets.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/IntTaxonomyFacets.java
@@ -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 {
diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyReader.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyReader.java
index b498466..4a64a69 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyReader.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyReader.java
@@ -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);