Re: [I] TopFieldCollector mistakenly assumes that all leaves share the same index sort [lucene]
romseygeek closed issue #14399: TopFieldCollector mistakenly assumes that all leaves share the same index sort URL: https://github.com/apache/lucene/issues/14399 -- 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]
Re: [I] TopFieldCollector mistakenly assumes that all leaves share the same index sort [lucene]
romseygeek commented on issue #14399: URL: https://github.com/apache/lucene/issues/14399#issuecomment-5092052551 > Happy to open a PR with the fix + test if the approach looks right. Please do! -- 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]
Re: [I] TopFieldCollector mistakenly assumes that all leaves share the same index sort [lucene]
serhiy-bzhezytskyy commented on issue #14399: URL: https://github.com/apache/lucene/issues/14399#issuecomment-5005381173 I looked into this and was able to turn it into a concrete failing test: a `MultiReader` over two indexes sorted in opposite directions (`ndv asc` and `ndv desc`), searched with `ndv asc`. The competitive document lives at the end of the second segment's docid order, so the cached "search sort is a prefix of the index sort" decision from the first segment wrongly early-terminates the second segment and drops it — the search returns a non-competitive value instead of the true top hit. So it's a wrong-results bug, not just a theoretical one. I have a fix along the lines of what @jpountz suggested — decide per segment instead of caching across leaves. In `TopFieldLeafCollector` the prefix check is now computed for each segment, and when it's true the collector calls `disableSkipping()` on that segment's leaf comparators. On the method-move point: rather than moving `FieldComparator#disableSkipping` to `LeafFieldComparator`, I added `disableSkipping()` as a **default (no-op) method on `LeafFieldComparator`** and implemented it on `NumericComparator`/`TermOrdValComparator`'s leaf comparators (they drop their competitive iterator for that segment). That keeps it a backward-compatible API addition rather than a move/removal. `FieldComparator#disableSkipping` stays as-is since it's still used elsewhere. Does that direction seem acceptable, or would you prefer the full move you mentioned? Happy to open a PR with the fix + test if the approach looks right. -- 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]
Re: [I] TopFieldCollector mistakenly assumes that all leaves share the same index sort [lucene]
msokolov commented on issue #14399: URL: https://github.com/apache/lucene/issues/14399#issuecomment-2891382202 > Would it make sense to have different collectors for the two cases, one with and one without a cache? -- 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]
Re: [I] TopFieldCollector mistakenly assumes that all leaves share the same index sort [lucene]
jpountz commented on issue #14399: URL: https://github.com/apache/lucene/issues/14399#issuecomment-2872278104 What are the two cases that you have in mind? I don't think that having a collector with a cache makes sense since it has an assumption that leaves are uniform, which may not be correct. However, we could have different `LeafCollector`s for the case when the search sort is a prefix of the index sort on the one hand, and the case when the sort sort is not a prefix of the index sort on the other hand. -- 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]
Re: [I] TopFieldCollector mistakenly assumes that all leaves share the same index sort [lucene]
msokolov commented on issue #14399: URL: https://github.com/apache/lucene/issues/14399#issuecomment-2869828209 Would it make sense to have different collectors for the two cases, one with and one without a cache? -- 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]
Re: [I] TopFieldCollector mistakenly assumes that all leaves share the same index sort [lucene]
jpountz commented on issue #14399: URL: https://github.com/apache/lucene/issues/14399#issuecomment-2869526058 I don't see an obvious solution either. My preference would be to remove the cache and make this decision on a per-segment basis, but this would require moving some methods around, e.g. `Comparator#disableSkipping` -> `LeafComparator#disableSkipping`. -- 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]
Re: [I] TopFieldCollector mistakenly assumes that all leaves share the same index sort [lucene]
jainankitk commented on issue #14399: URL: https://github.com/apache/lucene/issues/14399#issuecomment-2867626533 @jpountz - Any thoughts? -- 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]
Re: [I] TopFieldCollector mistakenly assumes that all leaves share the same index sort [lucene]
jainankitk commented on issue #14399: URL: https://github.com/apache/lucene/issues/14399#issuecomment-2800571535 This is an interesting issue, and as such I don't see any good solution, other than removing the cache itself. I am wondering if it is good idea for Collector to know the `List`, similar to `setWeight` for passing `Weight` to Collector. `TopFieldCollector` should be able to compute `searchSortPartOfIndexSort` correctly and use the information within `TopFieldLeafCollector`. -- 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]
