You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/11/08 22:33:05 UTC

[GitHub] [lucene] gsmiller commented on a change in pull request #264: LUCENE-10062: Switch to numeric doc values for encoding taxonomy ordinals (instead of custom binary format)

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



##########
File path: lucene/facet/src/java/org/apache/lucene/facet/taxonomy/DocValuesOrdinalsReader.java
##########
@@ -59,16 +53,21 @@ public void get(int docID, IntsRef ordinals) throws IOException {
               "docs out of order: lastDocID=" + lastDocID + " vs docID=" + docID);
         }
         lastDocID = docID;
-        if (docID > values.docID()) {
-          values.advance(docID);
-        }
-        final BytesRef bytes;
-        if (values.docID() == docID) {
-          bytes = values.binaryValue();
-        } else {
-          bytes = new BytesRef(BytesRef.EMPTY_BYTES);
+
+        ordinals.offset = 0;
+        ordinals.length = 0;
+
+        if (dv.advanceExact(docID)) {
+          int count = dv.docValueCount();
+          if (ordinals.ints.length < count) {
+            ordinals.ints = ArrayUtil.grow(ordinals.ints, count);
+          }
+
+          for (int i = 0; i < count; i++) {
+            ordinals.ints[ordinals.length] = (int) dv.nextValue();

Review comment:
       We're effectively doing this check already in `FacetsConfig` when we write the ordinals since we're explicitly using `int` and `int[]` to track the ordinals for each document before adding them to the `SortedNumericDocValuesField`. So we're always writing `int` values into the field when done through `FacetsConfig`. On the other hand, if the user just goes and indexes whatever they want into a `SortedNumericDocValuesField` and then tries to facet on it, they could run into issues (but that's true in many places in `facets` today).




-- 
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-unsubscribe@lucene.apache.org

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



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