mirror of https://github.com/apache/lucene.git
LUCENE-10500: StringValueFacetCounts to not rely on sequential collection (#788)
StringValueFacetCounts should use the segment ordinal instead of the current index when looping through the matching hits, as when search is multi-threaded the order of the matching hits (one per segment) is not deterministic.
This commit is contained in:
parent
6062ba0b3b
commit
796a19b457
|
@ -279,10 +279,7 @@ public class StringValueFacetCounts extends Facets {
|
|||
// should all ladder up to the same top-level reader:
|
||||
validateState(matchingDocs.get(0).context);
|
||||
|
||||
for (int i = 0; i < matchingDocs.size(); i++) {
|
||||
|
||||
FacetsCollector.MatchingDocs hits = matchingDocs.get(i);
|
||||
|
||||
for (FacetsCollector.MatchingDocs hits : matchingDocs) {
|
||||
// Assuming the state is valid, ordinalMap should be non-null and docValues should be
|
||||
// a MultiSortedSetDocValues since we have more than one segment:
|
||||
assert ordinalMap != null;
|
||||
|
@ -291,7 +288,7 @@ public class StringValueFacetCounts extends Facets {
|
|||
MultiDocValues.MultiSortedSetDocValues multiValues =
|
||||
(MultiDocValues.MultiSortedSetDocValues) docValues;
|
||||
|
||||
countOneSegment(multiValues.values[i], hits.context.ord, hits, null);
|
||||
countOneSegment(multiValues.values[hits.context.ord], hits.context.ord, hits, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue