Skip to content

SlowCompositeReaderWrapper: fix index sort and hasBlocks - #4825

Open
dsmiley wants to merge 1 commit into
apache:mainfrom
dsmiley:SlowCompositeReaderWrapper
Open

SlowCompositeReaderWrapper: fix index sort and hasBlocks#4825
dsmiley wants to merge 1 commit into
apache:mainfrom
dsmiley:SlowCompositeReaderWrapper

Conversation

@dsmiley

@dsmiley dsmiley commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Both were derived from the first segment's LeafMetaData only, which is wrong once the composite view has more than one leaf:

  • sort() claimed the first segment's index sort even when stacking multiple segments end-to-end, which does not preserve that sort as a whole. Consumers act on the claim (TopFieldCollector stops collecting a leaf once the search sort is a prefix of the index sort), so a search over this wrapper could silently drop hits.
  • hasBlocks() reported false whenever segment 0 happened to have no blocks, even if a later segment did.

sort() is now null except in the trivial single-leaf case; hasBlocks() is now the OR across all leaves, since a block is never split across segments.

_disclaimer: saw this in an experiment/hack; didn't see in the real world nor in existing tests _

…d docs) for multi-segment views

Both were derived from the first segment's LeafMetaData only, which is
wrong once the composite view has more than one leaf:

- sort() claimed the first segment's index sort even when stacking
  multiple segments end-to-end, which does not preserve that sort as
  a whole. Consumers act on the claim (TopFieldCollector stops
  collecting a leaf once the search sort is a prefix of the index
  sort), so a search over this wrapper could silently drop hits.
- hasBlocks() reported false whenever segment 0 happened to have no
  blocks, even if a later segment did.

sort() is now null except in the trivial single-leaf case; hasBlocks()
is now the OR across all leaves, since a block is never split across
segments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant