jpountz commented on PR #873: URL: https://github.com/apache/lucene/pull/873#issuecomment-1128797150
When the order is reversed, your change negates the `node` twice so that we keep tie-breaking by increasing node IDs in all cases. With this fix, I wonder if we could simplify the encoding logic by only making the `score` affected by the order, not the `node`? I'm thinking of something like this (which may be incorrect, I haven't tested it): ``` float multiplicator = reversed ? -1f : 1f; // could be precomputed int sortableScore = NumericUtils.floatToSortableInt(multiplicator * score); long encoded = ((long) sortableScore << 32) | (Integer.MAX_VALUE - node); ``` -- 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: issues-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org