Reject binary doc-values update on an index sort field - #16565
Merged
Conversation
updateBinaryDocValue lacked the index-sort guard that updateNumericDocValue and the varargs updateDocValues already have. An index sort field is never binary, so the check goes before the doc-values-type validation, which would otherwise mask it with a less clear type-mismatch error.
jimczi
force-pushed
the
binary-dv-update-index-sort-guard
branch
from
August 27, 2026 07:38
8f715ef to
79c2e45
Compare
jimczi
added a commit
to jimczi/lucene
that referenced
this pull request
Aug 27, 2026
updateBinaryDocValue lacked the index-sort guard that updateNumericDocValue and the varargs updateDocValues already have. An index sort field is never binary, so the check goes before the doc-values-type validation, which would otherwise mask it with a less clear type-mismatch error.
jimczi
added a commit
to jimczi/lucene
that referenced
this pull request
Aug 27, 2026
updateBinaryDocValue lacked the index-sort guard that updateNumericDocValue and the varargs updateDocValues already have. An index sort field is never binary, so the check goes before the doc-values-type validation, which would otherwise mask it with a less clear type-mismatch error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IndexWriter.updateBinaryDocValueis missing the index-sort guard thatupdateNumericDocValueand the varargsupdateDocValues(Term, Field...)already have: it does not reject updating a field that is part of the index sort. Updating a sort field's doc values would make the persisted sort order inconsistent with the values, so it should be rejected up front like the numeric path.The check goes before
verifyOrCreateDvOnlyFieldhere (unlike the numeric method, which checks after). An index sort field is never backed by binary doc values, so if the check came after the type validation it would never be reached — the user would instead get a less clear doc-values-type mismatch error. Placing it first surfaces the same clear "cannot update docvalues field involved in the index sort" message the numeric path gives.Extended
TestIndexSorting.testBadDVUpdateto coverupdateBinaryDocValuealongside the existingupdateNumericDocValueand varargs assertions.