harshvardhanrp opened a new pull request, #16810: URL: https://github.com/apache/lucene/pull/16810
### Description Fixes #16809 As described in the issue, an IndexWriter whose config has no index sort accepts doc values updates on fields that existing segments are sorted by. The same happens after addIndexes(Directory) of a sorted index into an unsorted writer. The segments keep saying they are sorted, so sorted searches and IndexSortSortedNumericDocValuesRangeQuery can return wrong results. The update checks only looked at config.getIndexSortFields(). With this change IndexWriter also remembers the sort fields of existing segments, when it opens and after addIndexes(Directory), and rejects updates on those fields. The four copies of the check are now one method, ensureNotIndexSortField. The error message stays the same. Tests: added testBadDVUpdateWithoutIndexSort and testBadDVUpdateAfterAddIndexes to TestIndexSorting. Both fail without the fix and pass with it. TestIndexSorting, the doc values update tests and the whole org.apache.lucene.index test package pass, and ./gradlew :lucene:core:check -x test is clean. -- 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]
