Skip to:
TextMultiValues wraps an underlying DocValues instance, and we often use the following pattern:
TextMultiValues
DocValues
https://github.com/hibernate/hibernate-search/blob/077ac00939656c80559f526399b28b3d297cf0d2/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/docvalues/impl/JoiningTextMultiValuesSource.java#L96-L99
Essentially this code assumes that nextChild() will advance the underlying DocValues instance, so it calls values.nextOrd() right away, assuming that method is already aware that we advanced to a new docId.
nextChild()
values.nextOrd()
But we actually have a cache in TextMultiValues:
https://github.com/hibernate/hibernate-search/blob/077ac00939656c80559f526399b28b3d297cf0d2/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/docvalues/impl/TextMultiValues.java#L88-L124
And if we never call TextMultiValues#advanceExact, that cache doesn't get updated and could lead to incorrect behavior in TextMultiValues#nextOrd.
TextMultiValues#advanceExact
TextMultiValues#nextOrd
And in fact, in Lucene 10 it does: https://github.com/hibernate/hibernate-search/pull/3746#issuecomment-1733109330
TextMultiValues
wraps an underlyingDocValues
instance, and we often use the following pattern:https://github.com/hibernate/hibernate-search/blob/077ac00939656c80559f526399b28b3d297cf0d2/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/docvalues/impl/JoiningTextMultiValuesSource.java#L96-L99
Essentially this code assumes that
nextChild()
will advance the underlyingDocValues
instance, so it callsvalues.nextOrd()
right away, assuming that method is already aware that we advanced to a new docId.But we actually have a cache in
TextMultiValues
:https://github.com/hibernate/hibernate-search/blob/077ac00939656c80559f526399b28b3d297cf0d2/backend/lucene/src/main/java/org/hibernate/search/backend/lucene/lowlevel/docvalues/impl/TextMultiValues.java#L88-L124
And if we never call
TextMultiValues#advanceExact
, that cache doesn't get updated and could lead to incorrect behavior inTextMultiValues#nextOrd
.And in fact, in Lucene 10 it does: https://github.com/hibernate/hibernate-search/pull/3746#issuecomment-1733109330