Ensure vector queries handle advanceShallow correctly#14858
Ensure vector queries handle advanceShallow correctly#14858benwtrent merged 3 commits intoapache:branch_9_12from
Conversation
jpountz
left a comment
There was a problem hiding this comment.
does getMaxScore need fixing as well? I see that it adds context.docBase too.
| public int advanceShallow(int docid) { | ||
| if (docid == NO_MORE_DOCS) { | ||
| return NO_MORE_DOCS; | ||
| } |
There was a problem hiding this comment.
Should it instead be something like below?
if (docid >= context.reader.maxDoc()) { // out of range
return NO_MORE_DOCS;
} Otherwise we may be computing blocks based on hits that belong to other segments?
There was a problem hiding this comment.
Ah yeah! Let me get that
I suppose this gets handled by the |
|
Sneaky bug! Thanks for fixing @benwtrent |
|
This looks like a safe change to backport to me. |
|
@jpountz @vigyasharma I changed this PR to just be a backport of #12146 It fixes both maxscore & advshallow bugs while greatly simplifying the code. |
Basically, advanceShallow for knn queries can flip back from hitting NO_MORE_DOCS to a valid doc ID again. This can cause search higher level queries to flip back and forth breaking assumptions and causing a CPU core to be locked up in-definitely (until server reboot). Applies the fix provided here, but requires gathering score docs again: apache/lucene#14858 closes: #130239
closes: #14857