lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sha...@apache.org
Subject svn commit: r1546819 - in /lucene/dev/trunk/solr: ./ core/src/java/org/apache/solr/handler/component/ core/src/test/org/apache/solr/
Date Sun, 01 Dec 2013 15:06:42 GMT
Author: shalin
Date: Sun Dec  1 15:06:42 2013
New Revision: 1546819

URL: http://svn.apache.org/r1546819
Log:
SOLR-5204: StatsComponent and SpellCheckComponent do not support the shards.tolerant=true
parameter

Modified:
    lucene/dev/trunk/solr/CHANGES.txt
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java
    lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/StatsComponent.java
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestDistributedSearch.java

Modified: lucene/dev/trunk/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/CHANGES.txt?rev=1546819&r1=1546818&r2=1546819&view=diff
==============================================================================
--- lucene/dev/trunk/solr/CHANGES.txt (original)
+++ lucene/dev/trunk/solr/CHANGES.txt Sun Dec  1 15:06:42 2013
@@ -169,6 +169,9 @@ Bug Fixes
 * SOLR-5515: NPE when getting stats on date field with empty result on
   SolrCloud. (Alexander Sagen, shalin)
 
+* SOLR-5204: StatsComponent and SpellCheckComponent do not support the
+  shards.tolerant=true parameter. (Anca Kopetz, shalin)
+
 Optimizations
 ----------------------
 

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java?rev=1546819&r1=1546818&r2=1546819&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java
(original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/SpellCheckComponent.java
Sun Dec  1 15:06:42 2013
@@ -320,7 +320,16 @@ public class SpellCheckComponent extends
     if (maxResultsForSuggest==null || !isCorrectlySpelled) {
       for (ShardRequest sreq : rb.finished) {
         for (ShardResponse srsp : sreq.responses) {
-          NamedList nl = (NamedList) srsp.getSolrResponse().getResponse().get("spellcheck");
+          NamedList nl = null;
+          try {
+            nl = (NamedList) srsp.getSolrResponse().getResponse().get("spellcheck");
+          } catch (Exception e) {
+            if (rb.req.getParams().getBool(ShardParams.SHARDS_TOLERANT, false)) {
+              continue; // looks like a shard did not return anything
+            }
+            throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+                "Unable to read spelling info for shard: " + srsp.getShard(), e);
+          }
           LOG.info(srsp.getShard() + " " + nl);
           if (nl != null) {
             mergeData.totalNumberShardResponses++;

Modified: lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/StatsComponent.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/StatsComponent.java?rev=1546819&r1=1546818&r2=1546819&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/StatsComponent.java
(original)
+++ lucene/dev/trunk/solr/core/src/java/org/apache/solr/handler/component/StatsComponent.java
Sun Dec  1 15:06:42 2013
@@ -102,7 +102,16 @@ public class StatsComponent extends Sear
     StatsInfo si = rb._statsInfo;
 
     for (ShardResponse srsp : sreq.responses) {
-      NamedList stats = (NamedList) srsp.getSolrResponse().getResponse().get("stats");
+      NamedList stats = null;
+      try {
+        stats = (NamedList) srsp.getSolrResponse().getResponse().get("stats");
+      } catch (Exception e) {
+        if (rb.req.getParams().getBool(ShardParams.SHARDS_TOLERANT, false)) {
+          continue; // looks like a shard did not return anything
+        }
+        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR,
+            "Unable to read stats info for shard: " + srsp.getShard(), e);
+      }
 
       NamedList stats_fields = (NamedList) stats.get("stats_fields");
       if (stats_fields != null) {

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestDistributedSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestDistributedSearch.java?rev=1546819&r1=1546818&r2=1546819&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestDistributedSearch.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/TestDistributedSearch.java Sun Dec
 1 15:06:42 2013
@@ -105,6 +105,8 @@ public class TestDistributedSearch exten
            t1,"no eggs on wall, lesson learned", 
            oddField, "odd man out");
 
+    indexr(id, "1001", "lowerfilt", "toyota"); // for spellcheck
+
     indexr(id, 14, "SubjectTerms_mfacet", new String[]  {"mathematical models", "mathematical
analysis"});
     indexr(id, 15, "SubjectTerms_mfacet", new String[]  {"test 1", "test 2", "test3"});
     indexr(id, 16, "SubjectTerms_mfacet", new String[]  {"test 1", "test 2", "test3"});
@@ -227,6 +229,9 @@ public class TestDistributedSearch exten
     query("q","*:*", "fl", "id", "fl",nint, "fl",tint,"sort",i1 + " desc");
     query("q","*:*", "fl",nint, "fl", "id", "fl",tint,"sort",i1 + " desc");
 
+    // basic spellcheck testing
+    query("q", "toyata", "fl", "id,lowerfilt", "spellcheck", true, "spellcheck.q", "toyata",
"qt", "spellCheckCompRH_Direct", "shards.qt", "spellCheckCompRH_Direct");
+
     stress=0;  // turn off stress... we want to tex max combos in min time
     for (int i=0; i<25*RANDOM_MULTIPLIER; i++) {
       String f = fieldNames[random().nextInt(fieldNames.length)];
@@ -336,7 +341,7 @@ public class TestDistributedSearch exten
     
     assertNotNull("missing shard info", sinfo);
     assertEquals("should have an entry for each shard ["+sinfo+"] "+shards, cnt, sinfo.size());
-    
+
     // test shards.tolerant=true
     for(int numDownServers = 0; numDownServers < jettys.size()-1; numDownServers++)
     {
@@ -383,6 +388,22 @@ public class TestDistributedSearch exten
           ShardParams.SHARDS_INFO, "true",
           ShardParams.SHARDS_TOLERANT, "true");
 
+      queryPartialResults(upShards, upClients,
+          "q", "*:*",
+          "stats", "true",
+          "stats.field", i1,
+          ShardParams.SHARDS_INFO, "true",
+          ShardParams.SHARDS_TOLERANT, "true");
+
+      queryPartialResults(upShards, upClients,
+          "q", "toyata",
+          "spellcheck", "true",
+          "spellcheck.q", "toyata",
+          "qt", "spellCheckCompRH_Direct",
+          "shards.qt", "spellCheckCompRH_Direct",
+          ShardParams.SHARDS_INFO, "true",
+          ShardParams.SHARDS_TOLERANT, "true");
+
       // restart the jettys
       for (JettySolrRunner downJetty : downJettys) {
         downJetty.start();
@@ -409,7 +430,7 @@ public class TestDistributedSearch exten
     }
   }
   
-  protected void queryPartialResults(final List<String> upShards, 
+  protected void queryPartialResults(final List<String> upShards,
                                      final List<SolrServer> upClients, 
                                      Object... q) throws Exception {
     



Mime
View raw message