lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cpoersc...@apache.org
Subject [2/2] lucene-solr:branch_6x: SOLR-10383: Fix debug related NullPointerException in solr/contrib/ltr OriginalScoreFeature class. (Vitezslav Zak, Christine Poerschke)
Date Mon, 03 Apr 2017 12:35:17 GMT
SOLR-10383: Fix debug related NullPointerException in solr/contrib/ltr OriginalScoreFeature
class.
(Vitezslav Zak, Christine Poerschke)


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/ff840ad5
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/ff840ad5
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/ff840ad5

Branch: refs/heads/branch_6x
Commit: ff840ad59c4eccc834e43c54194643a99a0f697a
Parents: 05cfe13
Author: Christine Poerschke <cpoerschke@apache.org>
Authored: Mon Apr 3 13:01:16 2017 +0100
Committer: Christine Poerschke <cpoerschke@apache.org>
Committed: Mon Apr 3 13:22:27 2017 +0100

----------------------------------------------------------------------
 solr/CHANGES.txt                                         |  8 ++++++++
 .../apache/solr/ltr/feature/OriginalScoreFeature.java    |  2 +-
 .../solr/ltr/feature/TestOriginalScoreFeature.java       | 11 +++++++++--
 3 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ff840ad5/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 497b925..834f122 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -113,6 +113,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.

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ff840ad5/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/OriginalScoreFeature.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/OriginalScoreFeature.java
b/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/OriginalScoreFeature.java
index f402f32..c885d8a 100644
--- a/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/OriginalScoreFeature.java
+++ b/solr/contrib/ltr/src/java/org/apache/solr/ltr/feature/OriginalScoreFeature.java
@@ -114,7 +114,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

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/ff840ad5/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestOriginalScoreFeature.java
----------------------------------------------------------------------
diff --git a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestOriginalScoreFeature.java
b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestOriginalScoreFeature.java
index 4eb9bea..f4c0df1 100644
--- a/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestOriginalScoreFeature.java
+++ b/solr/contrib/ltr/src/test/org/apache/solr/ltr/feature/TestOriginalScoreFeature.java
@@ -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'");
+    }
   }
 
 }


Mime
View raw message