Luca Cavanna created LUCENE-10500:
-------------------------------------

             Summary: StringValueFacetCounts relies on sequential collection
                 Key: LUCENE-10500
                 URL: https://issues.apache.org/jira/browse/LUCENE-10500
             Project: Lucene - Core
          Issue Type: Bug
            Reporter: Luca Cavanna


We recently moved some of the facets tests to use IndexSearcher#search(Query, 
CollectorManager) providing a FacetsCollectorManager instead of a 
FacetsCollector. Whenever newIndexSearcher(IndexReader) is used in tests, 
concurrent search may now be exercised while it was not before.

This caused some build failures on TestStringValueFacetCounts:

{code:java}
java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
        at 
__randomizedtesting.SeedInfo.seed([ED8BF8281FCE5C02:9FC7DD27AEAEEA71]:0)
        at 
org.apache.lucene.core@10.0.0-SNAPSHOT/org.apache.lucene.util.packed.Packed64.get(Packed64.java:81)
        at 
org.apache.lucene.core@10.0.0-SNAPSHOT/org.apache.lucene.index.OrdinalMap$2.get(OrdinalMap.java:346)
        at 
org.apache.lucene.facet.StringValueFacetCounts.countOneSegment(StringValueFacetCounts.java:440)
        at 
org.apache.lucene.facet.StringValueFacetCounts.count(StringValueFacetCounts.java:295)
        at 
org.apache.lucene.facet.StringValueFacetCounts.<init>(StringValueFacetCounts.java:123)
        at 
org.apache.lucene.facet.TestStringValueFacetCounts.checkFacetResult(TestStringValueFacetCounts.java:349)
        at 
org.apache.lucene.facet.TestStringValueFacetCounts.testRandom(TestStringValueFacetCounts.java:325)
{code}

This looks like a real bug, as StringValueFacetCounts#countOneSegment is called 
once providing the index of the current loop instead of the ordinal taken from 
the matching hits that we are analyzing. That works fine with single threaded 
collection as we will go sequentially and the two indices will always be the 
same. With multi-threaded search, the order of the returned matching hits (one 
per segment) is not deterministic.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org
For additional commands, e-mail: issues-h...@lucene.apache.org

Reply via email to