1212import org .apache .lucene .index .BinaryDocValues ;
1313import org .apache .lucene .index .DocValues ;
1414import org .apache .lucene .index .LeafReader ;
15+ import org .apache .lucene .index .SortedDocValues ;
1516import org .apache .lucene .index .SortedSetDocValues ;
1617import org .apache .lucene .util .BitUtil ;
1718import org .apache .lucene .util .BytesRef ;
@@ -46,7 +47,7 @@ public String fieldName() {
4647 @ Override
4748 public DocValuesLoader docValuesLoader (LeafReader leafReader , int [] docIdsInLeaf ) throws IOException {
4849 SortedSetDocValues valueDocValues = DocValues .getSortedSet (leafReader , name );
49- BinaryDocValues offsetDocValues = DocValues .getBinary (leafReader , offsetsFieldName );
50+ SortedDocValues offsetDocValues = DocValues .getSorted (leafReader , offsetsFieldName );
5051
5152 return docValues = new DocValuesWithOffsetsLoader (valueDocValues , offsetDocValues );
5253 }
@@ -77,15 +78,15 @@ public void write(XContentBuilder b) throws IOException {
7778 }
7879
7980 static final class DocValuesWithOffsetsLoader implements DocValuesLoader {
80- private final BinaryDocValues offsetDocValues ;
81+ private final SortedDocValues offsetDocValues ;
8182 private final SortedSetDocValues valueDocValues ;
8283 private final ByteArrayStreamInput scratch = new ByteArrayStreamInput ();
8384
8485 private boolean hasValue ;
8586 private boolean hasOffset ;
8687 private int [] offsetToOrd ;
8788
88- DocValuesWithOffsetsLoader (SortedSetDocValues valueDocValues , BinaryDocValues offsetDocValues ) {
89+ DocValuesWithOffsetsLoader (SortedSetDocValues valueDocValues , SortedDocValues offsetDocValues ) {
8990 this .valueDocValues = valueDocValues ;
9091 this .offsetDocValues = offsetDocValues ;
9192 }
@@ -96,7 +97,8 @@ public boolean advanceToDoc(int docId) throws IOException {
9697 hasOffset = offsetDocValues .advanceExact (docId );
9798 if (hasValue || hasOffset ) {
9899 if (hasOffset ) {
99- var encodedValue = offsetDocValues .binaryValue ();
100+ int offsetOrd = offsetDocValues .ordValue ();
101+ var encodedValue = offsetDocValues .lookupOrd (offsetOrd );
100102 scratch .reset (encodedValue .bytes , encodedValue .offset , encodedValue .length );
101103 offsetToOrd = parseOffsetArray (scratch );
102104 } else {
0 commit comments