mirror of https://github.com/apache/lucene.git
SOLR-10383: Fix debug related NullPointerException in solr/contrib/ltr OriginalScoreFeature class.
(Vitezslav Zak, Christine Poerschke)
This commit is contained in:
parent
cbe610035b
commit
9868907fe7
|
@ -196,6 +196,14 @@ Other Changes
|
|||
|
||||
* SOLR-9601: Redone DataImportHandler 'tika' example, removing all unused and irrelevant definitions (Alexandre Rafalovitch)
|
||||
|
||||
================== 6.5.1 ==================
|
||||
|
||||
Bug Fixes
|
||||
----------------------
|
||||
|
||||
* SOLR-10383: Fix debug related NullPointerException in solr/contrib/ltr OriginalScoreFeature class.
|
||||
(Vitezslav Zak, Christine Poerschke)
|
||||
|
||||
================== 6.5.0 ==================
|
||||
|
||||
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.
|
||||
|
|
|
@ -104,7 +104,7 @@ public class OriginalScoreFeature extends Feature {
|
|||
// was already scored in step 1
|
||||
// we shouldn't need to calc original score again.
|
||||
final DocInfo docInfo = getDocInfo();
|
||||
return (docInfo.hasOriginalDocScore() ? docInfo.getOriginalDocScore() : originalScorer.score());
|
||||
return (docInfo != null && docInfo.hasOriginalDocScore() ? docInfo.getOriginalDocScore() : originalScorer.score());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.ArrayList;
|
|||
import java.util.Map;
|
||||
|
||||
import org.apache.solr.client.solrj.SolrQuery;
|
||||
import org.apache.solr.common.params.CommonParams;
|
||||
import org.apache.solr.ltr.FeatureLoggerTestUtils;
|
||||
import org.apache.solr.ltr.TestRerankBase;
|
||||
import org.apache.solr.ltr.model.LinearModel;
|
||||
|
@ -106,7 +107,10 @@ public class TestOriginalScoreFeature extends TestRerankBase {
|
|||
final String doc3Score = ((Double) ((Map<String,Object>) ((ArrayList<Object>) ((Map<String,Object>) jsonParse
|
||||
.get("response")).get("docs")).get(3)).get("score")).toString();
|
||||
|
||||
final boolean debugQuery = false;
|
||||
final boolean debugQuery = random().nextBoolean();
|
||||
if (debugQuery) {
|
||||
query.add(CommonParams.DEBUG_QUERY, "true");
|
||||
}
|
||||
|
||||
query.remove("fl");
|
||||
query.add("fl", "*, score, fv:[fv]");
|
||||
|
@ -142,7 +146,10 @@ public class TestOriginalScoreFeature extends TestRerankBase {
|
|||
}
|
||||
|
||||
assertJQ("/query" + query.toQueryString(), "/response/docs/["+docIdx+"]/fv=='"+fv+"'");
|
||||
// TODO: use debugQuery
|
||||
if (debugQuery) {
|
||||
assertJQ("/query" + query.toQueryString(),
|
||||
"/debug/explain/"+docId+"=='\n"+origScoreFeatureValue+" = LinearModel(name="+modelName+",featureWeights=["+origScoreFeatureName+"=1.0]) model applied to features, sum of:\n "+origScoreFeatureValue+" = prod of:\n 1.0 = weight on feature\n "+origScoreFeatureValue+" = OriginalScoreFeature [query:"+query.getQuery()+"]\n'");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue