LUCENE-10491: Fix correctness bug in TaxonomyFacetSumValueSource score providing (#775)

This commit is contained in:
Greg Miller 2022-03-30 09:36:05 -07:00 committed by GitHub
parent c4935d2fa3
commit fb83387002
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 2 deletions

View File

@ -93,6 +93,9 @@ Bug Fixes
* LUCENE-10477: Highlighter: WeightedSpanTermExtractor.extractWeightedSpanTerms to Query#rewrite * LUCENE-10477: Highlighter: WeightedSpanTermExtractor.extractWeightedSpanTerms to Query#rewrite
multiple times if necessary. (Christine Poerschke, Adrien Grand) multiple times if necessary. (Christine Poerschke, Adrien Grand)
* LUCENE-10491: A correctness bug in the way scores are provided within TaxonomyFacetSumValueSource
was fixed. (Michael McCandless, Greg Miller)
Build Build
--------------------- ---------------------

View File

@ -75,7 +75,7 @@ public class TaxonomyFacetSumValueSource extends FloatTaxonomyFacets {
@Override @Override
public boolean advanceExact(int doc) throws IOException { public boolean advanceExact(int doc) throws IOException {
index++; index = doc;
return true; return true;
} }
}; };

View File

@ -353,8 +353,13 @@ public class TestTaxonomyFacetSumValueSource extends FacetTestCase {
IndexWriter iw = new IndexWriter(indexDir, newIndexWriterConfig(new MockAnalyzer(random()))); IndexWriter iw = new IndexWriter(indexDir, newIndexWriterConfig(new MockAnalyzer(random())));
FacetsConfig config = new FacetsConfig(); FacetsConfig config = new FacetsConfig();
// Add a doc without the price field to exercise the bug found in LUCENE-10491:
Document doc = new Document();
iw.addDocument(config.build(taxoWriter, doc));
for (int i = 0; i < 4; i++) { for (int i = 0; i < 4; i++) {
Document doc = new Document(); doc = new Document();
doc.add(new NumericDocValuesField("price", (i + 1))); doc.add(new NumericDocValuesField("price", (i + 1)));
doc.add(new FacetField("a", Integer.toString(i % 2))); doc.add(new FacetField("a", Integer.toString(i % 2)));
iw.addDocument(config.build(taxoWriter, doc)); iw.addDocument(config.build(taxoWriter, doc));