@@ -514,42 +514,41 @@ protected long pick(SortedNumericDocValues values) throws IOException {
514514 * NOTE: Calling the returned instance on docs that are not root docs is illegal
515515 * The returned instance can only be evaluate the current and upcoming docs
516516 */
517- public NumericDocValues select (final SortedNumericDocValues values , final long missingValue , final BitSet rootDocs , final DocIdSetIterator innerDocs , int maxDoc ) throws IOException {
518- if (rootDocs == null || innerDocs == null ) {
517+ public NumericDocValues select (final SortedNumericDocValues values , final long missingValue , final BitSet parentDocs , final DocIdSetIterator childDocs , int maxDoc ) throws IOException {
518+ if (parentDocs == null || childDocs == null ) {
519519 return select (DocValues .emptySortedNumeric (maxDoc ), missingValue );
520520 }
521521
522522 return new AbstractNumericDocValues () {
523523
524- int lastSeenRootDoc = -1 ;
524+ int lastSeenParentDoc = -1 ;
525525 long lastEmittedValue = missingValue ;
526526
527527 @ Override
528- public boolean advanceExact (int rootDoc ) throws IOException {
529- assert rootDocs .get (rootDoc ) : "can only sort root documents" ;
530- assert rootDoc >= lastSeenRootDoc : "can only evaluate current and upcoming root docs" ;
531- if (rootDoc == lastSeenRootDoc ) {
528+ public boolean advanceExact (int parentDoc ) throws IOException {
529+ assert parentDoc >= lastSeenParentDoc : "can only evaluate current and upcoming parent docs" ;
530+ if (parentDoc == lastSeenParentDoc ) {
532531 return true ;
533- } else if (rootDoc == 0 ) {
532+ } else if (parentDoc == 0 ) {
534533 lastEmittedValue = missingValue ;
535534 return true ;
536535 }
537- final int prevRootDoc = rootDocs .prevSetBit (rootDoc - 1 );
538- final int firstNestedDoc ;
539- if (innerDocs .docID () > prevRootDoc ) {
540- firstNestedDoc = innerDocs .docID ();
536+ final int prevParentDoc = parentDocs .prevSetBit (parentDoc - 1 );
537+ final int firstChildDoc ;
538+ if (childDocs .docID () > prevParentDoc ) {
539+ firstChildDoc = childDocs .docID ();
541540 } else {
542- firstNestedDoc = innerDocs .advance (prevRootDoc + 1 );
541+ firstChildDoc = childDocs .advance (prevParentDoc + 1 );
543542 }
544543
545- lastSeenRootDoc = rootDoc ;
546- lastEmittedValue = pick (values , missingValue , innerDocs , firstNestedDoc , rootDoc );
544+ lastSeenParentDoc = parentDoc ;
545+ lastEmittedValue = pick (values , missingValue , childDocs , firstChildDoc , parentDoc );
547546 return true ;
548547 }
549548
550549 @ Override
551550 public int docID () {
552- return lastSeenRootDoc ;
551+ return lastSeenParentDoc ;
553552 }
554553
555554 @ Override
@@ -624,33 +623,32 @@ protected double pick(SortedNumericDoubleValues values) throws IOException {
624623 * NOTE: Calling the returned instance on docs that are not root docs is illegal
625624 * The returned instance can only be evaluate the current and upcoming docs
626625 */
627- public NumericDoubleValues select (final SortedNumericDoubleValues values , final double missingValue , final BitSet rootDocs , final DocIdSetIterator innerDocs , int maxDoc ) throws IOException {
628- if (rootDocs == null || innerDocs == null ) {
626+ public NumericDoubleValues select (final SortedNumericDoubleValues values , final double missingValue , final BitSet parentDocs , final DocIdSetIterator childDocs , int maxDoc ) throws IOException {
627+ if (parentDocs == null || childDocs == null ) {
629628 return select (FieldData .emptySortedNumericDoubles (), missingValue );
630629 }
631630
632631 return new NumericDoubleValues () {
633632
634- int lastSeenRootDoc = 0 ;
633+ int lastSeenParentDoc = 0 ;
635634 double lastEmittedValue = missingValue ;
636635
637636 @ Override
638- public boolean advanceExact (int rootDoc ) throws IOException {
639- assert rootDocs .get (rootDoc ) : "can only sort root documents" ;
640- assert rootDoc >= lastSeenRootDoc : "can only evaluate current and upcoming root docs" ;
641- if (rootDoc == lastSeenRootDoc ) {
637+ public boolean advanceExact (int parentDoc ) throws IOException {
638+ assert parentDoc >= lastSeenParentDoc : "can only evaluate current and upcoming parent docs" ;
639+ if (parentDoc == lastSeenParentDoc ) {
642640 return true ;
643641 }
644- final int prevRootDoc = rootDocs .prevSetBit (rootDoc - 1 );
645- final int firstNestedDoc ;
646- if (innerDocs .docID () > prevRootDoc ) {
647- firstNestedDoc = innerDocs .docID ();
642+ final int prevParentDoc = parentDocs .prevSetBit (parentDoc - 1 );
643+ final int firstChildDoc ;
644+ if (childDocs .docID () > prevParentDoc ) {
645+ firstChildDoc = childDocs .docID ();
648646 } else {
649- firstNestedDoc = innerDocs .advance (prevRootDoc + 1 );
647+ firstChildDoc = childDocs .advance (prevParentDoc + 1 );
650648 }
651649
652- lastSeenRootDoc = rootDoc ;
653- lastEmittedValue = pick (values , missingValue , innerDocs , firstNestedDoc , rootDoc );
650+ lastSeenParentDoc = parentDoc ;
651+ lastEmittedValue = pick (values , missingValue , childDocs , firstChildDoc , parentDoc );
654652 return true ;
655653 }
656654
@@ -733,8 +731,8 @@ protected BytesRef pick(SortedBinaryDocValues values) throws IOException {
733731 * NOTE: Calling the returned instance on docs that are not root docs is illegal
734732 * The returned instance can only be evaluate the current and upcoming docs
735733 */
736- public BinaryDocValues select (final SortedBinaryDocValues values , final BytesRef missingValue , final BitSet rootDocs , final DocIdSetIterator innerDocs , int maxDoc ) throws IOException {
737- if (rootDocs == null || innerDocs == null ) {
734+ public BinaryDocValues select (final SortedBinaryDocValues values , final BytesRef missingValue , final BitSet parentDocs , final DocIdSetIterator childDocs , int maxDoc ) throws IOException {
735+ if (parentDocs == null || childDocs == null ) {
738736 return select (FieldData .emptySortedBinary (), missingValue );
739737 }
740738 final BinaryDocValues selectedValues = select (values , null );
@@ -743,27 +741,26 @@ public BinaryDocValues select(final SortedBinaryDocValues values, final BytesRef
743741
744742 final BytesRefBuilder builder = new BytesRefBuilder ();
745743
746- int lastSeenRootDoc = 0 ;
744+ int lastSeenParentDoc = 0 ;
747745 BytesRef lastEmittedValue = missingValue ;
748746
749747 @ Override
750- public boolean advanceExact (int rootDoc ) throws IOException {
751- assert rootDocs .get (rootDoc ) : "can only sort root documents" ;
752- assert rootDoc >= lastSeenRootDoc : "can only evaluate current and upcoming root docs" ;
753- if (rootDoc == lastSeenRootDoc ) {
748+ public boolean advanceExact (int parentDoc ) throws IOException {
749+ assert parentDoc >= lastSeenParentDoc : "can only evaluate current and upcoming root docs" ;
750+ if (parentDoc == lastSeenParentDoc ) {
754751 return true ;
755752 }
756753
757- final int prevRootDoc = rootDocs .prevSetBit (rootDoc - 1 );
758- final int firstNestedDoc ;
759- if (innerDocs .docID () > prevRootDoc ) {
760- firstNestedDoc = innerDocs .docID ();
754+ final int prevParentDoc = parentDocs .prevSetBit (parentDoc - 1 );
755+ final int firstChildDoc ;
756+ if (childDocs .docID () > prevParentDoc ) {
757+ firstChildDoc = childDocs .docID ();
761758 } else {
762- firstNestedDoc = innerDocs .advance (prevRootDoc + 1 );
759+ firstChildDoc = childDocs .advance (prevParentDoc + 1 );
763760 }
764761
765- lastSeenRootDoc = rootDoc ;
766- lastEmittedValue = pick (selectedValues , builder , innerDocs , firstNestedDoc , rootDoc );
762+ lastSeenParentDoc = parentDoc ;
763+ lastEmittedValue = pick (selectedValues , builder , childDocs , firstChildDoc , parentDoc );
767764 if (lastEmittedValue == null ) {
768765 lastEmittedValue = missingValue ;
769766 }
@@ -850,16 +847,16 @@ protected int pick(SortedSetDocValues values) throws IOException {
850847 * NOTE: Calling the returned instance on docs that are not root docs is illegal
851848 * The returned instance can only be evaluate the current and upcoming docs
852849 */
853- public SortedDocValues select (final SortedSetDocValues values , final BitSet rootDocs , final DocIdSetIterator innerDocs ) throws IOException {
854- if (rootDocs == null || innerDocs == null ) {
850+ public SortedDocValues select (final SortedSetDocValues values , final BitSet parentDocs , final DocIdSetIterator childDocs ) throws IOException {
851+ if (parentDocs == null || childDocs == null ) {
855852 return select (DocValues .emptySortedSet ());
856853 }
857854 final SortedDocValues selectedValues = select (values );
858855
859856 return new AbstractSortedDocValues () {
860857
861858 int docID = -1 ;
862- int lastSeenRootDoc = 0 ;
859+ int lastSeenParentDoc = 0 ;
863860 int lastEmittedOrd = -1 ;
864861
865862 @ Override
@@ -873,23 +870,22 @@ public int getValueCount() {
873870 }
874871
875872 @ Override
876- public boolean advanceExact (int rootDoc ) throws IOException {
877- assert rootDocs .get (rootDoc ) : "can only sort root documents" ;
878- assert rootDoc >= lastSeenRootDoc : "can only evaluate current and upcoming root docs" ;
879- if (rootDoc == lastSeenRootDoc ) {
873+ public boolean advanceExact (int parentDoc ) throws IOException {
874+ assert parentDoc >= lastSeenParentDoc : "can only evaluate current and upcoming root docs" ;
875+ if (parentDoc == lastSeenParentDoc ) {
880876 return lastEmittedOrd != -1 ;
881877 }
882878
883- final int prevRootDoc = rootDocs .prevSetBit (rootDoc - 1 );
884- final int firstNestedDoc ;
885- if (innerDocs .docID () > prevRootDoc ) {
886- firstNestedDoc = innerDocs .docID ();
879+ final int prevParentDoc = parentDocs .prevSetBit (parentDoc - 1 );
880+ final int firstChildDoc ;
881+ if (childDocs .docID () > prevParentDoc ) {
882+ firstChildDoc = childDocs .docID ();
887883 } else {
888- firstNestedDoc = innerDocs .advance (prevRootDoc + 1 );
884+ firstChildDoc = childDocs .advance (prevParentDoc + 1 );
889885 }
890886
891- docID = lastSeenRootDoc = rootDoc ;
892- lastEmittedOrd = pick (selectedValues , innerDocs , firstNestedDoc , rootDoc );
887+ docID = lastSeenParentDoc = parentDoc ;
888+ lastEmittedOrd = pick (selectedValues , childDocs , firstChildDoc , parentDoc );
893889 return lastEmittedOrd != -1 ;
894890 }
895891
0 commit comments