gsmiller commented on a change in pull request #443:
URL: https://github.com/apache/lucene/pull/443#discussion_r751465599



##########
File path: 
lucene/facet/src/java/org/apache/lucene/facet/taxonomy/TaxonomyFacetLabels.java
##########
@@ -62,7 +62,16 @@ public TaxonomyFacetLabels(TaxonomyReader taxoReader, String 
indexFieldName) thr
    * @throws IOException when a low-level IO issue occurs
    */
   public FacetLabelReader getFacetLabelReader(LeafReaderContext readerContext) 
throws IOException {
-    return new FacetLabelReader(ordsReader, readerContext);
+    // Support older binary format by leveraging an OrdinalsReader, which can 
still support both
+    // formats for now:
+    if (FacetUtils.usesOlderBinaryOrdinals(readerContext.reader())) {
+      OrdinalsReader ordsReader = new DocValuesOrdinalsReader(indexFieldName);
+      return new FacetLabelReader(ordsReader, readerContext);
+    }
+
+    SortedNumericDocValues ordinalValues =

Review comment:
       Sure! Makes sense to be extra defensive here. Note that 
`DocValues#getSortedNumeric` is never meant to return `null` as part of the API 
contract (unlike accessing doc values from the reader directly). Part of the 
"niceness" that the `DocValues` factory methods include is returning an "empty" 
doc values instance instead of null if it doesn't exist.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to