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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]