You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ho...@apache.org on 2016/07/11 22:08:00 UTC

[1/2] lucene-solr:master: SOLR-9287: Including 'score' in the 'fl' param when doing an RTG no longer causes an NPE

Repository: lucene-solr
Updated Branches:
  refs/heads/branch_6x 268021af9 -> b3cc4b311
  refs/heads/master e66ff585d -> 462dc04cb


SOLR-9287: Including 'score' in the 'fl' param when doing an RTG no longer causes an NPE


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

Branch: refs/heads/master
Commit: 462dc04cb6aaf3a876b56f27c6b511b00e25e85a
Parents: e66ff58
Author: Chris Hostetter <ho...@apache.org>
Authored: Mon Jul 11 14:35:06 2016 -0700
Committer: Chris Hostetter <ho...@apache.org>
Committed: Mon Jul 11 14:35:06 2016 -0700

----------------------------------------------------------------------
 solr/CHANGES.txt                                 |  3 +++
 .../org/apache/solr/response/ResultContext.java  |  2 +-
 .../solr/search/TestPseudoReturnFields.java      | 19 ++++++++++++-------
 3 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/462dc04c/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 45488fc..af249be 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -144,6 +144,9 @@ Bug Fixes
 * SOLR-9291: ZkSolrResourceLoader should not retry fetching resources if the server has been shutdown.
   (shalin)
 
+* SOLR-9287: Including 'score' in the 'fl' param when doing an RTG no longer causes an NPE
+  (hossman, Ishan Chattopadhyaya)
+
 Optimizations
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/462dc04c/solr/core/src/java/org/apache/solr/response/ResultContext.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/response/ResultContext.java b/solr/core/src/java/org/apache/solr/response/ResultContext.java
index b36355f..a9aff25 100644
--- a/solr/core/src/java/org/apache/solr/response/ResultContext.java
+++ b/solr/core/src/java/org/apache/solr/response/ResultContext.java
@@ -48,7 +48,7 @@ public abstract class ResultContext {
   public abstract SolrQueryRequest getRequest();
 
   public boolean wantsScores() {
-    return getReturnFields().wantsScore() && getDocList().hasScores();
+    return getReturnFields() != null && getReturnFields().wantsScore() && getDocList() != null && getDocList().hasScores();
   }
 
   public Iterator<SolrDocument> getProcessedDocuments() {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/462dc04c/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java b/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java
index 2b6848b..8b85ba0 100644
--- a/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java
+++ b/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java
@@ -162,7 +162,6 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
     }
   }
   
-  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-9287")
   public void testScoreAndAllRealFieldsRTG() throws Exception {
   
     // if we use RTG (committed or otherwise) score should be ignored
@@ -209,7 +208,6 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
             );
   }
 
-  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-9287")
   public void testScoreAndExplicitRealFieldsRTG() throws Exception {
     // if we use RTG (committed or otherwise) score should be ignored
     for (String id : Arrays.asList("42","99")) {
@@ -348,8 +346,9 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
     
   }
   
-  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-9287")
+  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-9285")
   public void testFunctionsAndScoreRTG() throws Exception {
+    // NOTE: once this test is fixed to pass, testAugmentersRTG should also be updated to test a abs(val_i)
 
     // if we use RTG (committed or otherwise) score should be ignored
     for (String id : Arrays.asList("42","99")) {
@@ -492,7 +491,6 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
     }
   }
   
-  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-9287")
   public void testGlobsAndScoreRTG() throws Exception {
     // behavior shouldn't matter if we are committed or uncommitted, score should be ignored
     for (String id : Arrays.asList("42","99")) {
@@ -563,6 +561,7 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
     // behavior shouldn't matter if we are committed or uncommitted
     for (String id : Arrays.asList("42","99")) {
       // NOTE: once testDocIdAugmenterRTG can pass, [docid] should be tested here as well.
+      // NOTE: once testFunctionsAndScoreRTG can pass, abs(val_i) should be tested here as well
       for (SolrParams p : Arrays.asList(params("fl","[shard],[explain],x_alias:[value v=10 t=int]"),
                                         params("fl","[shard]","fl","[explain],x_alias:[value v=10 t=int]"),
                                         params("fl","[shard]","fl","[explain]","fl","x_alias:[value v=10 t=int]"))) {
@@ -570,6 +569,7 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
                 req(p, "qt","/get","id",id, "wt","xml")
                 ,"count(//doc)=1"
                 // ,"//doc/int[@name='[docid]']" // TODO
+                // ,"//doc/gloat[@name='abs(val_i)']" // TODO
                 ,"//doc/str[@name='[shard]'][.='[not a shard request]']"
                 // RTG: [explain] should be missing (ignored)
                 ,"//doc/int[@name='x_alias'][.=10]"
@@ -601,6 +601,7 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
     // behavior shouldn't matter if we are committed or uncommitted
     for (String id : Arrays.asList("42","99")) {
       // NOTE: once testDocIdAugmenterRTG can pass, [docid] should be tested here as well.
+      // NOTE: once testFunctionsAndScoreRTG can pass, abs(val_i) should be tested here as well
       for (SolrParams p : Arrays.asList(params("fl","id,[explain],x_alias:[value v=10 t=int]"),
                                         params("fl","id","fl","[explain],x_alias:[value v=10 t=int]"),
                                         params("fl","id","fl","[explain]","fl","x_alias:[value v=10 t=int]"))) {
@@ -609,6 +610,7 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
                 ,"count(//doc)=1"
                 ,"//doc/str[@name='id']"
                 // ,"//doc/int[@name='[docid]']" // TODO
+                // ,"//doc/gloat[@name='abs(val_i)']" // TODO
                 // RTG: [explain] should be missing (ignored)
                 ,"//doc/int[@name='x_alias'][.=10]"
                 
@@ -646,15 +648,16 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
     }
   }
   
-  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-9287")
   public void testAugmentersAndScoreRTG() throws Exception {
     // if we use RTG (committed or otherwise) score should be ignored
     for (String id : Arrays.asList("42","99")) {
       // NOTE: once testDocIdAugmenterRTG can pass, [docid] should be tested here as well.
+      // NOTE: once testFunctionsAndScoreRTG can pass, abs(val_i) should be tested here as well
       assertQ(id,
               req("qt","/get","id",id, "wt","xml",
                   "fl","x_alias:[value v=10 t=int],score")
               // ,"//doc/int[@name='[docid]']" // TODO
+              // ,"//doc/gloat[@name='abs(val_i)']" // TODO
               ,"//doc/int[@name='x_alias'][.=10]"
               
               ,"//doc[count(*)=1]"
@@ -667,6 +670,7 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
                 req(p, "qt","/get","id",id, "wt","xml")
                 
                 // ,"//doc/int[@name='[docid]']" // TODO
+                // ,"//doc/gloat[@name='abs(val_i)']" // TODO
                 ,"//doc/int[@name='x_alias'][.=10]"
                 // RTG: [explain] and score should be missing (ignored)
                 
@@ -710,13 +714,13 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
     }
   }
   
-  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-9287")
   public void testAugmentersGlobsExplicitAndScoreOhMyRTG() throws Exception {
     Random random = random();
 
     // NOTE: 'ssto' is the missing one
     final List<String> fl = Arrays.asList
       // NOTE: once testDocIdAugmenterRTG can pass, [docid] should be tested here as well.
+      // NOTE: once testFunctionsAndScoreRTG can pass, abs(val_i) should be tested here as well
       ("id","[explain]","score","val_*","subj*");
     
     final int iters = atLeast(random, 10);
@@ -738,10 +742,11 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
                   ,"count(//doc)=1"
                   ,"//doc/str[@name='id']"
                   // ,"//doc/int[@name='[docid]']" // TODO
+                  // ,"//doc/gloat[@name='abs(val_i)']" // TODO
                   // RTG: [explain] and score should be missing (ignored)
                   ,"//doc/int[@name='val_i'][.=1]"
                   ,"//doc/str[@name='subject']"
-                  ,"//result/doc[count(*)=3]"
+                  ,"//doc[count(*)=3]"
                   );
         }
       }


[2/2] lucene-solr:branch_6x: SOLR-9287: Including 'score' in the 'fl' param when doing an RTG no longer causes an NPE

Posted by ho...@apache.org.
SOLR-9287: Including 'score' in the 'fl' param when doing an RTG no longer causes an NPE

(cherry picked from commit 462dc04cb6aaf3a876b56f27c6b511b00e25e85a)


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

Branch: refs/heads/branch_6x
Commit: b3cc4b3111120c43747a60177389ff9ad7a5a840
Parents: 268021a
Author: Chris Hostetter <ho...@apache.org>
Authored: Mon Jul 11 14:35:06 2016 -0700
Committer: Chris Hostetter <ho...@apache.org>
Committed: Mon Jul 11 14:35:31 2016 -0700

----------------------------------------------------------------------
 solr/CHANGES.txt                                 |  3 +++
 .../org/apache/solr/response/ResultContext.java  |  2 +-
 .../solr/search/TestPseudoReturnFields.java      | 19 ++++++++++++-------
 3 files changed, 16 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b3cc4b31/solr/CHANGES.txt
----------------------------------------------------------------------
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 84583f0..d8cff7b 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -107,6 +107,9 @@ Bug Fixes
 * SOLR-9291: ZkSolrResourceLoader should not retry fetching resources if the server has been shutdown.
   (shalin)
 
+* SOLR-9287: Including 'score' in the 'fl' param when doing an RTG no longer causes an NPE
+  (hossman, Ishan Chattopadhyaya)
+
 Optimizations
 ----------------------
 

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b3cc4b31/solr/core/src/java/org/apache/solr/response/ResultContext.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/response/ResultContext.java b/solr/core/src/java/org/apache/solr/response/ResultContext.java
index b36355f..a9aff25 100644
--- a/solr/core/src/java/org/apache/solr/response/ResultContext.java
+++ b/solr/core/src/java/org/apache/solr/response/ResultContext.java
@@ -48,7 +48,7 @@ public abstract class ResultContext {
   public abstract SolrQueryRequest getRequest();
 
   public boolean wantsScores() {
-    return getReturnFields().wantsScore() && getDocList().hasScores();
+    return getReturnFields() != null && getReturnFields().wantsScore() && getDocList() != null && getDocList().hasScores();
   }
 
   public Iterator<SolrDocument> getProcessedDocuments() {

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/b3cc4b31/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java
----------------------------------------------------------------------
diff --git a/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java b/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java
index 2b6848b..8b85ba0 100644
--- a/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java
+++ b/solr/core/src/test/org/apache/solr/search/TestPseudoReturnFields.java
@@ -162,7 +162,6 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
     }
   }
   
-  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-9287")
   public void testScoreAndAllRealFieldsRTG() throws Exception {
   
     // if we use RTG (committed or otherwise) score should be ignored
@@ -209,7 +208,6 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
             );
   }
 
-  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-9287")
   public void testScoreAndExplicitRealFieldsRTG() throws Exception {
     // if we use RTG (committed or otherwise) score should be ignored
     for (String id : Arrays.asList("42","99")) {
@@ -348,8 +346,9 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
     
   }
   
-  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-9287")
+  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-9285")
   public void testFunctionsAndScoreRTG() throws Exception {
+    // NOTE: once this test is fixed to pass, testAugmentersRTG should also be updated to test a abs(val_i)
 
     // if we use RTG (committed or otherwise) score should be ignored
     for (String id : Arrays.asList("42","99")) {
@@ -492,7 +491,6 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
     }
   }
   
-  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-9287")
   public void testGlobsAndScoreRTG() throws Exception {
     // behavior shouldn't matter if we are committed or uncommitted, score should be ignored
     for (String id : Arrays.asList("42","99")) {
@@ -563,6 +561,7 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
     // behavior shouldn't matter if we are committed or uncommitted
     for (String id : Arrays.asList("42","99")) {
       // NOTE: once testDocIdAugmenterRTG can pass, [docid] should be tested here as well.
+      // NOTE: once testFunctionsAndScoreRTG can pass, abs(val_i) should be tested here as well
       for (SolrParams p : Arrays.asList(params("fl","[shard],[explain],x_alias:[value v=10 t=int]"),
                                         params("fl","[shard]","fl","[explain],x_alias:[value v=10 t=int]"),
                                         params("fl","[shard]","fl","[explain]","fl","x_alias:[value v=10 t=int]"))) {
@@ -570,6 +569,7 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
                 req(p, "qt","/get","id",id, "wt","xml")
                 ,"count(//doc)=1"
                 // ,"//doc/int[@name='[docid]']" // TODO
+                // ,"//doc/gloat[@name='abs(val_i)']" // TODO
                 ,"//doc/str[@name='[shard]'][.='[not a shard request]']"
                 // RTG: [explain] should be missing (ignored)
                 ,"//doc/int[@name='x_alias'][.=10]"
@@ -601,6 +601,7 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
     // behavior shouldn't matter if we are committed or uncommitted
     for (String id : Arrays.asList("42","99")) {
       // NOTE: once testDocIdAugmenterRTG can pass, [docid] should be tested here as well.
+      // NOTE: once testFunctionsAndScoreRTG can pass, abs(val_i) should be tested here as well
       for (SolrParams p : Arrays.asList(params("fl","id,[explain],x_alias:[value v=10 t=int]"),
                                         params("fl","id","fl","[explain],x_alias:[value v=10 t=int]"),
                                         params("fl","id","fl","[explain]","fl","x_alias:[value v=10 t=int]"))) {
@@ -609,6 +610,7 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
                 ,"count(//doc)=1"
                 ,"//doc/str[@name='id']"
                 // ,"//doc/int[@name='[docid]']" // TODO
+                // ,"//doc/gloat[@name='abs(val_i)']" // TODO
                 // RTG: [explain] should be missing (ignored)
                 ,"//doc/int[@name='x_alias'][.=10]"
                 
@@ -646,15 +648,16 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
     }
   }
   
-  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-9287")
   public void testAugmentersAndScoreRTG() throws Exception {
     // if we use RTG (committed or otherwise) score should be ignored
     for (String id : Arrays.asList("42","99")) {
       // NOTE: once testDocIdAugmenterRTG can pass, [docid] should be tested here as well.
+      // NOTE: once testFunctionsAndScoreRTG can pass, abs(val_i) should be tested here as well
       assertQ(id,
               req("qt","/get","id",id, "wt","xml",
                   "fl","x_alias:[value v=10 t=int],score")
               // ,"//doc/int[@name='[docid]']" // TODO
+              // ,"//doc/gloat[@name='abs(val_i)']" // TODO
               ,"//doc/int[@name='x_alias'][.=10]"
               
               ,"//doc[count(*)=1]"
@@ -667,6 +670,7 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
                 req(p, "qt","/get","id",id, "wt","xml")
                 
                 // ,"//doc/int[@name='[docid]']" // TODO
+                // ,"//doc/gloat[@name='abs(val_i)']" // TODO
                 ,"//doc/int[@name='x_alias'][.=10]"
                 // RTG: [explain] and score should be missing (ignored)
                 
@@ -710,13 +714,13 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
     }
   }
   
-  @AwaitsFix(bugUrl="https://issues.apache.org/jira/browse/SOLR-9287")
   public void testAugmentersGlobsExplicitAndScoreOhMyRTG() throws Exception {
     Random random = random();
 
     // NOTE: 'ssto' is the missing one
     final List<String> fl = Arrays.asList
       // NOTE: once testDocIdAugmenterRTG can pass, [docid] should be tested here as well.
+      // NOTE: once testFunctionsAndScoreRTG can pass, abs(val_i) should be tested here as well
       ("id","[explain]","score","val_*","subj*");
     
     final int iters = atLeast(random, 10);
@@ -738,10 +742,11 @@ public class TestPseudoReturnFields extends SolrTestCaseJ4 {
                   ,"count(//doc)=1"
                   ,"//doc/str[@name='id']"
                   // ,"//doc/int[@name='[docid]']" // TODO
+                  // ,"//doc/gloat[@name='abs(val_i)']" // TODO
                   // RTG: [explain] and score should be missing (ignored)
                   ,"//doc/int[@name='val_i'][.=1]"
                   ,"//doc/str[@name='subject']"
-                  ,"//result/doc[count(*)=3]"
+                  ,"//doc[count(*)=3]"
                   );
         }
       }