lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thelabd...@apache.org
Subject svn commit: r1659699 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/core/ solr/core/src/java/org/apache/solr/handler/component/ solr/core/src/test/org/apache/solr/handler/component/
Date Fri, 13 Feb 2015 22:10:57 GMT
Author: thelabdude
Date: Fri Feb 13 22:10:56 2015
New Revision: 1659699

URL: http://svn.apache.org/r1659699
Log:
SOLR-6311: SearchHandler should use path when no qt or shard.qt parameter is specified

Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/core/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
    lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java

Modified: lucene/dev/branches/branch_5x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/CHANGES.txt?rev=1659699&r1=1659698&r2=1659699&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_5x/solr/CHANGES.txt Fri Feb 13 22:10:56 2015
@@ -107,6 +107,10 @@ Other Changes
 
 * SOLR-7103: Remove unused method params in faceting code. (shalin)
 
+* SOLR-6311: When performing distributed queries, SearchHandler should use path
+  when no qt or shard.qt parameter is specified; fix also resolves SOLR-4479.
+  (Steve Molloy, Timothy Potter)
+
 ==================  5.0.0 ==================
 
 Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java?rev=1659699&r1=1659698&r2=1659699&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/handler/component/SearchHandler.java
Fri Feb 13 22:10:56 2015
@@ -18,6 +18,7 @@
 package org.apache.solr.handler.component;
 
 import org.apache.lucene.index.ExitableDirectoryReader;
+import org.apache.lucene.util.Version;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.SolrException;
@@ -306,10 +307,21 @@ public class SearchHandler extends Reque
                 params.set("NOW", Long.toString(rb.requestInfo.getNOW().getTime()));
               }
               String shardQt = params.get(ShardParams.SHARDS_QT);
-              if (shardQt == null) {
-                params.remove(CommonParams.QT);
-              } else {
+              if (shardQt != null) {
                 params.set(CommonParams.QT, shardQt);
+              } else {
+                // for distributed queries that don't include shards.qt, use the original
path
+                // as the default but operators need to update their luceneMatchVersion to
enable
+                // this behavior since it did not work this way prior to 5.1
+                if (req.getCore().getSolrConfig().luceneMatchVersion.onOrAfter(Version.LUCENE_5_1_0))
{
+                  String reqPath = (String)req.getContext().get("path");
+                  if (!"/select".equals(reqPath)) {
+                    params.set(CommonParams.QT, reqPath);
+                  } // else if path is /select, then the qt gets passed thru if set
+                } else {
+                  // this is the pre-5.1 behavior, which translates to sending the shard
request to /select
+                  params.remove(CommonParams.QT);
+                }
               }
               shardHandler1.submit(sreq, shard, params);
             }

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java?rev=1659699&r1=1659698&r2=1659699&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java
(original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/component/TermVectorComponentDistributedTest.java
Fri Feb 13 22:10:56 2015
@@ -123,19 +123,16 @@ public class TermVectorComponentDistribu
     final String tv = "tvrh";
 
     for (String q : new String[] {"id:0", "id:7", "id:[3 TO 6]", "*:*"}) {
-
       query("sort","id desc",
             "qt",tv, 
-            "shards.qt",tv,
-            "q", q, 
+            "q", q,
             TermVectorComponent.COMPONENT_NAME, "true", 
             TermVectorParams.TF, "true");
 
       // tv.fl diff from fl
       query("sort", "id asc",
             "qt",tv, 
-            "shards.qt",tv,
-            "q", q, 
+            "q", q,
             "fl", "*,score",
             "tv.fl", "test_basictv,test_offtv",
             TermVectorComponent.COMPONENT_NAME, "true", 
@@ -144,8 +141,7 @@ public class TermVectorComponentDistribu
       // multi-valued tv.fl 
       query("sort", "id asc",
             "qt",tv, 
-            "shards.qt",tv,
-            "q", q, 
+            "q", q,
             "fl", "*,score",
             "tv.fl", "test_basictv",
             "tv.fl","test_offtv",
@@ -154,16 +150,14 @@ public class TermVectorComponentDistribu
       // re-use fl glob
       query("sort", "id desc",
             "qt",tv, 
-            "shards.qt",tv,
-            "q", q, 
+            "q", q,
             "fl", "*,score",
             TermVectorComponent.COMPONENT_NAME, "true", 
             TermVectorParams.TF, "true");
       // re-use fl, ignore things we can't handle
       query("sort", "id desc",
             "qt",tv, 
-            "shards.qt",tv,
-            "q", q, 
+            "q", q,
             "fl", "score,test_basictv,[docid],test_postv,val:sum(3,4)",
             TermVectorComponent.COMPONENT_NAME, "true", 
             TermVectorParams.TF, "true");
@@ -171,8 +165,7 @@ public class TermVectorComponentDistribu
       // re-use (multi-valued) fl, ignore things we can't handle
       query("sort", "id desc",
             "qt",tv, 
-            "shards.qt",tv,
-            "q", q, 
+            "q", q,
             "fl", "score,test_basictv",
             "fl", "[docid],test_postv,val:sum(3,4)",
             TermVectorComponent.COMPONENT_NAME, "true", 
@@ -182,8 +175,7 @@ public class TermVectorComponentDistribu
     
       query("sort", "id asc",
             "qt",tv, 
-            "shards.qt",tv,
-            "q", q, 
+            "q", q,
             TermVectorComponent.COMPONENT_NAME, "true",
             TermVectorParams.TF, "true", 
             TermVectorParams.DF, "true", 
@@ -193,8 +185,7 @@ public class TermVectorComponentDistribu
     
       query("sort", "id desc",
             "qt",tv, 
-            "shards.qt",tv,
-            "q", q, 
+            "q", q,
             TermVectorComponent.COMPONENT_NAME, "true",
             TermVectorParams.ALL, "true");
     
@@ -202,8 +193,7 @@ public class TermVectorComponentDistribu
 
       query("sort", "id desc",
             "qt",tv, 
-            "shards.qt",tv,
-            "q", q, 
+            "q", q,
             TermVectorComponent.COMPONENT_NAME, "true",
             TermVectorParams.TF, "true", 
             TermVectorParams.DF, "true", 



Mime
View raw message