You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by jp...@apache.org on 2022/04/05 20:42:11 UTC
[lucene] branch main updated: LUCENE-10500: StringValueFacetCounts to not rely on sequential collection (#788)
This is an automated email from the ASF dual-hosted git repository.
jpountz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/lucene.git
The following commit(s) were added to refs/heads/main by this push:
new 796a19b4576 LUCENE-10500: StringValueFacetCounts to not rely on sequential collection (#788)
796a19b4576 is described below
commit 796a19b457691249b0f3c2fc837f82a378d1d2c6
Author: Luca Cavanna <ja...@users.noreply.github.com>
AuthorDate: Tue Apr 5 22:42:06 2022 +0200
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.
---
.../src/java/org/apache/lucene/facet/StringValueFacetCounts.java | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/lucene/facet/src/java/org/apache/lucene/facet/StringValueFacetCounts.java b/lucene/facet/src/java/org/apache/lucene/facet/StringValueFacetCounts.java
index fdb8fd49a9b..6876d36c9a7 100644
--- a/lucene/facet/src/java/org/apache/lucene/facet/StringValueFacetCounts.java
+++ b/lucene/facet/src/java/org/apache/lucene/facet/StringValueFacetCounts.java
@@ -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);
}
}
}