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 2020/07/22 14:04:46 UTC
[lucene-solr] branch branch_8x updated: LUCENE-9437: make
DocValuesOrdinalsReader.decode public
This is an automated email from the ASF dual-hosted git repository.
mikemccand pushed a commit to branch branch_8x
in repository https://gitbox.apache.org/repos/asf/lucene-solr.git
The following commit(s) were added to refs/heads/branch_8x by this push:
new 17041d4 LUCENE-9437: make DocValuesOrdinalsReader.decode public
17041d4 is described below
commit 17041d4028180c48237694637c9ec1796315e7dc
Author: Mike McCandless <mi...@apache.org>
AuthorDate: Wed Jul 22 09:57:04 2020 -0400
LUCENE-9437: make DocValuesOrdinalsReader.decode public
---
lucene/CHANGES.txt | 4 ++++
.../lucene/facet/taxonomy/DocValuesOrdinalsReader.java | 15 +++++++++++++--
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/lucene/CHANGES.txt b/lucene/CHANGES.txt
index 05ca341..c828405 100644
--- a/lucene/CHANGES.txt
+++ b/lucene/CHANGES.txt
@@ -9,6 +9,10 @@ API Changes
---------------------
(No changes)
+* LUCENE-9437: Lucene's facet module's DocValuesOrdinalsReader.decode method
+ is now public, making it easier for applications to decode facet
+ ordinals into their corresponding labels (Ankur)
+
New Features
---------------------
diff --git a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/DocValuesOrdinalsReader.java b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/DocValuesOrdinalsReader.java
index fd48849..f4c31e5 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/DocValuesOrdinalsReader.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/taxonomy/DocValuesOrdinalsReader.java
@@ -78,8 +78,19 @@ public class DocValuesOrdinalsReader extends OrdinalsReader {
return field;
}
- /** Subclass and override if you change the encoding. */
- protected void decode(BytesRef buf, IntsRef ordinals) {
+ /**
+ * Subclass and override if you change the encoding.
+ * The method is marked 'public' to allow decoding of binary payload containing ordinals
+ * without instantiating an {@link org.apache.lucene.facet.taxonomy.OrdinalsReader.OrdinalsSegmentReader}.
+ *
+ * This takes care of use cases where an application instantiates {@link org.apache.lucene.index.BinaryDocValues}
+ * reader for a facet field outside this class, reads the binary payload for a document and decodes the ordinals
+ * in the payload.
+ *
+ * @param buf binary payload containing encoded ordinals
+ * @param ordinals buffer for decoded ordinals
+ */
+ public void decode(BytesRef buf, IntsRef ordinals) {
// grow the buffer up front, even if by a large number of values (buf.length)
// that saves the need to check inside the loop for every decoded value if