zihanx commented on issue #15905: URL: https://github.com/apache/lucene/issues/15905#issuecomment-5298258736
Closing this out. The API landed in #16496 (merged to `main`). **Outcome:** `ReaderUtil.partitionByLeaf(int[], leaves)` now returns a `PartitionedHits(int[][] docIdsByLeaf, int[][] ordinalsByLeaf)` record. The per-leaf ordinals record each doc ID's original position in the input array. Only one API is needed. **Design result:** - Took `int[]` instead of `ScoreDoc[]`. - Consolidated to a single API rather than separate with/without-ordinals methods. A JMH benchmark showed ordinal tracking is essentially free, thanks to a packed-long sort: each `(docId, ordinal)` is packed into a `long` (docId high 32 bits, ordinal low 32) and sorted with the primitive `Arrays.sort(long[])`. Callers that don't need ordinals just ignore `ordinalsByLeaf()`. Thanks @gsmiller for the design input and review! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
