Different Pos Results with NodesBetween and Doc.Resolve

I’m using old_state.doc.nodesBetween to get the absolute position in the doc of a particular node. But when I use old_state.doc.resolve(samePositionAsInNodesBetween) It resolves to a different node than is present in nodesBetween. Why is this? (assume that the states are the same of course)

The position provided by nodesBetween points before the node, so if you resolve it the parent of the resolved position will be the node’s parent. nodeAfter should give you the node at that position.

3 Likes