ChrisHegarty opened a new issue, #14561:
URL: https://github.com/apache/lucene/issues/14561

   The changes in https://github.com/apache/lucene/pull/14511 result in a 
change in behaviour. This should be analysed since #14511 has been backported 
in the 10.2.1 bugfix release.
   
   I've not yet fully groked what this, but it can be seen in the following 
test case ( which is a minimal reproducer extracted from an Elasticsearch 
environment ).
   
   ```
   
     public void testMinScore() throws Exception {
       try (var dir = newDirectory();
           var writer = new RandomIndexWriter(random(), dir)) {
         for (int i = 0; i < 10; i++) {
           Document doc = new Document();
           doc.add(new StringField("foo", "bar", Store.NO));
           writer.addDocument(doc);
         }
         try (IndexReader reader = writer.getReader()) {
           IndexSearcher searcher = new IndexSearcher(reader);
           BooleanQuery query =
               new BooleanQuery.Builder()
                   .add(new TermQuery(new Term("foo", "bar")), Occur.MUST)
                   .build();
           var collectorManager = new TopScoreDocCollectorManager(1, 5);
           var topDocs = searcher.search(query, collectorManager);
           assertEquals("Number of matched documents", 10, 
topDocs.totalHits.value());
         }
       }
     }
   ``` 
   
   Prior to #4511, this test passes, `topDocs.totalHits.value()` is `10`. After 
the change the test fails with:
   
   ```
   java.lang.AssertionError: Number of matched documents expected:<10> but 
was:<6>
        at 
__randomizedtesting.SeedInfo.seed([72CF7E3B874C10BF:2CC9BF76B3C91C58]:0)
        at org.junit.Assert.fail(Assert.java:89)
        at org.junit.Assert.failNotEquals(Assert.java:835)
        at org.junit.Assert.assertEquals(Assert.java:647)
        at 
org.apache.lucene.search.TestBooleanScorer.testMinScore(TestBooleanScorer.java:419)
        at 
java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
        at java.base/java.lang.reflect.Method.invoke(Method.java:580)
        at 
com.carrotsearch.randomizedtesting.RandomizedRunner.invoke(RandomizedRunner.java:1758)
   ...
   ```
   
   The pertinent changes are in 
   ```
             @Override
             public List<Impact> getImpacts(int level) {
               if (indexHasFreq == false) {
                 return DUMMY_IMPACTS_NO_FREQS;     //  <<<< HERE
               }
               ...
               return DUMMY_IMPACTS;
             }
   ```
   


-- 
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: issues-unsubscr...@lucene.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to