harshvardhanrp commented on PR #16810:
URL: https://github.com/apache/lucene/pull/16810#issuecomment-7240968294

   @epotyom  Thanks for the review!
   
   I found this while reading the doc-values update code in IndexWriter around 
#16581. The index-sort check only looked at the writer's config, not at how the 
segments were actually sorted. So I opened a sorted index with a plain config 
and updated the sort field. It went through, and a sorted search afterwards 
returned the wrong top hit.
   
   Good point on shrinking. segmentIndexSorts only grows, so a dropped sort 
field stays blocked even after merges have rewritten the old segments. A new 
writer rebuilds the set from the current segments, so it works after a reopen, 
but it's clunky.
   
   I kept it strict on purpose. If we block too much, the user gets a clear 
exception, but if we block too little, the segments break silently. Getting it 
exact is also tricky, because updates are applied after they're checked and 
addIndexes can bring in sorted segments in between. Happy to open a follow-up 
to recompute the set from the live segments if you think it's worth it!


-- 
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]

Reply via email to