[
https://issues.apache.org/jira/browse/LUCENE-10377?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17477117#comment-17477117
]
ASF subversion and git services commented on LUCENE-10377:
----------------------------------------------------------
Commit 2e2c4818d10e7db3ba6fabf5c0db630ad2cb57b0 in lucene's branch
refs/heads/main from Alan Woodward
[ https://gitbox.apache.org/repos/asf?p=lucene.git;h=2e2c481 ]
LUCENE-10377: Replace 'sortPos' with 'enableSkipping' in
SortField.getComparator() (#603)
The sort position parameter in SortField.getComparator() is only ever used
to determine whether or not skipping should be enabled on a given comparator,
so the parameter name should reflect that. This commit also explicitly disables
skipping in a number of cases where it is never used, in particular CheckIndex
and the grouping collectors.
> Replace 'sortPos' parameter in SortField.getComparator()
> --------------------------------------------------------
>
> Key: LUCENE-10377
> URL: https://issues.apache.org/jira/browse/LUCENE-10377
> Project: Lucene - Core
> Issue Type: Improvement
> Reporter: Alan Woodward
> Assignee: Alan Woodward
> Priority: Major
> Time Spent: 50m
> Remaining Estimate: 0h
>
> SortField.getComparator() takes two parameters: the number of hits we are
> collecting, so that the comparator can size its internal priority queue; and
> the position of this sortfield in the overall sort. This second parameter is
> only actually used to determine whether or not the SortField should enable
> various skipping operations, building comparative iterators etc. However,
> it's not clear from the API that this is why it is passed, and as a
> consequence all sorts of consumers of this API faithfully pass through their
> sort positions even when they aren't actually using skipping at all. In
> particular, CheckIndex does this when checking index sorts, and this in fact
> leads to a bug, where it will attempt to build skipping structures over
> fields from 8x-created indexes that did not have the same type constraints
> that 9x indexes do and incorrectly throw an error.
> I think we should replace this second parameter with a simple boolean,
> `enableSkipping`, that the TopHits collectors can pass as `true` for the
> first sortfield. Other APIs that use sorts but not skipping, like CheckIndex
> or the grouping collectors, can always pass `false` so we don't waste time
> building skipping structures that never get used.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]