Skip to content

Commit 32e95dd

Browse files
authored
SOLR-15071: Fix ArrayIndexOutOfBoundsException in contrib/ltr SolrFeatureScorer (#2196)
1 parent fb88b02 commit 32e95dd

File tree

4 files changed

+9
-7
lines changed

4 files changed

+9
-7
lines changed

solr/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,9 @@ Bug Fixes
366366

367367
* SOLR-15073: Fix ClassCastException in SystemInfoHandler.getSecurityInfo. (Nikolay Ivanov, Christine Poerschke)
368368

369+
* SOLR-15071: Fix ArrayIndexOutOfBoundsException in contrib/ltr SolrFeatureScorer.
370+
(Florin Babes, Ovidiu Mihalcea, David Smiley, Christine Poerschke)
371+
369372
Other Changes
370373
---------------------
371374

solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/Feature.java

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import org.apache.lucene.search.Query;
2828
import org.apache.lucene.search.QueryVisitor;
2929
import org.apache.lucene.search.Scorer;
30-
import org.apache.lucene.search.TwoPhaseIterator;
3130
import org.apache.lucene.search.Weight;
3231
import org.apache.lucene.util.Accountable;
3332
import org.apache.lucene.util.RamUsageEstimator;
@@ -365,10 +364,9 @@ public DocIdSetIterator iterator() {
365364
return in.iterator();
366365
}
367366

368-
@Override
369-
public TwoPhaseIterator twoPhaseIterator() {
370-
return in.twoPhaseIterator();
371-
}
367+
// Currently (Q1 2021) we intentionally don't delegate twoPhaseIterator()
368+
// because it doesn't always work and we don't yet know why, please see
369+
// SOLR-15071 for more details.
372370

373371
@Override
374372
public int advanceShallow(int target) throws IOException {

solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestEdisMaxSolrFeature.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.apache.solr.ltr.model.LinearModel;
2222
import org.junit.After;
2323
import org.junit.Before;
24-
import org.junit.Ignore;
2524
import org.junit.Test;
2625

2726
public class TestEdisMaxSolrFeature extends TestRerankBase {
@@ -75,7 +74,6 @@ public void testEdisMaxSolrFeature() throws Exception {
7574
assertJQ("/query" + query.toQueryString(), "/response/numFound/==4");
7675
}
7776

78-
@Ignore("SOLR-15071")
7977
@Test
8078
public void testEdisMaxSolrFeatureCustomMM() throws Exception {
8179
loadFeature(

solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestFeature.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ public void testFilterFeatureScorerOverridesScorerMethods() {
3030
for (final Method scorerClassMethod : Scorer.class.getDeclaredMethods()) {
3131
try {
3232

33+
// the FilterFeatureScorer may simply inherit Scorer's default implementation
34+
if (scorerClassMethod.getName().equals("twoPhaseIterator")) continue;
35+
3336
// the FilterFeatureScorer's implementation does not influence its parent Weight
3437
if (scorerClassMethod.getName().equals("getWeight")) continue;
3538

0 commit comments

Comments
 (0)