lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From markrmil...@apache.org
Subject svn commit: r1547461 - in /lucene/dev/branches/branch_4x: ./ solr/ solr/core/ solr/core/src/test/org/apache/solr/cloud/ solr/solrj/ solr/solrj/src/java/org/apache/solr/common/cloud/
Date Tue, 03 Dec 2013 16:25:34 GMT
Author: markrmiller
Date: Tue Dec  3 16:25:34 2013
New Revision: 1547461

URL: http://svn.apache.org/r1547461
Log:
SOLR-5502: A "/" in a document id will cause an exception to be thrown when using the composite
id router.

Modified:
    lucene/dev/branches/branch_4x/   (props changed)
    lucene/dev/branches/branch_4x/solr/   (props changed)
    lucene/dev/branches/branch_4x/solr/CHANGES.txt   (contents, props changed)
    lucene/dev/branches/branch_4x/solr/core/   (props changed)
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ShardRoutingTest.java
    lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/TriLevelCompositeIdRoutingTest.java
    lucene/dev/branches/branch_4x/solr/solrj/   (props changed)
    lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java

Modified: lucene/dev/branches/branch_4x/solr/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/CHANGES.txt?rev=1547461&r1=1547460&r2=1547461&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/CHANGES.txt (original)
+++ lucene/dev/branches/branch_4x/solr/CHANGES.txt Tue Dec  3 16:25:34 2013
@@ -153,6 +153,9 @@ Bug Fixes
 
 * SOLR-5527: DIH logs spurious warning for special commands. (shalin)
 
+* SOLR-5502: A "/" in a document id will cause an exception to be thrown
+  when using the composite id router. (Anshum Gupta via Mark Miller)
+  
 Optimizations
 ----------------------
 

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ShardRoutingTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ShardRoutingTest.java?rev=1547461&r1=1547460&r2=1547461&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ShardRoutingTest.java
(original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/ShardRoutingTest.java
Tue Dec  3 16:25:34 2013
@@ -148,30 +148,33 @@ public class ShardRoutingTest extends Ab
     doAddDoc("d!doc3");
     doAddDoc("e!doc4");
     doAddDoc("f1!f2!doc5");
+    // Check successful addition of a document with a '/' in the id part.
+    doAddDoc("f1!f2!doc5/5");
 
     doRTG("b!doc1");
     doRTG("c!doc2");
     doRTG("d!doc3");
     doRTG("e!doc4");
     doRTG("f1!f2!doc5");
+    doRTG("f1!f2!doc5/5");
     doRTG("b!doc1,c!doc2");
     doRTG("d!doc3,e!doc4");
 
     commit();
 
-    doQuery("b!doc1,c!doc2,d!doc3,e!doc4,f1!f2!doc5", "q","*:*");
-    doQuery("b!doc1,c!doc2,d!doc3,e!doc4,f1!f2!doc5", "q","*:*", "shards","shard1,shard2,shard3,shard4");
-    doQuery("b!doc1,c!doc2,d!doc3,e!doc4,f1!f2!doc5", "q","*:*", shardKeys,"b!,c!,d!,e!,f1!f2!");
+    doQuery("b!doc1,c!doc2,d!doc3,e!doc4,f1!f2!doc5,f1!f2!doc5/5", "q","*:*");
+    doQuery("b!doc1,c!doc2,d!doc3,e!doc4,f1!f2!doc5,f1!f2!doc5/5", "q","*:*", "shards","shard1,shard2,shard3,shard4");
+    doQuery("b!doc1,c!doc2,d!doc3,e!doc4,f1!f2!doc5,f1!f2!doc5/5", "q","*:*", shardKeys,"b!,c!,d!,e!,f1!f2!");
     doQuery("b!doc1", "q","*:*", shardKeys,"b!");
     doQuery("c!doc2", "q","*:*", shardKeys,"c!");
-    doQuery("d!doc3,f1!f2!doc5", "q","*:*", shardKeys,"d!");
+    doQuery("d!doc3,f1!f2!doc5,f1!f2!doc5/5", "q","*:*", shardKeys,"d!");
     doQuery("e!doc4", "q","*:*", shardKeys,"e!");
-    doQuery("f1!f2!doc5,d!doc3", "q","*:*", shardKeys,"f1/8!");
+    doQuery("f1!f2!doc5,d!doc3,f1!f2!doc5/5", "q","*:*", shardKeys,"f1/8!");
 
     // try using shards parameter
     doQuery("b!doc1", "q","*:*", "shards",bucket1);
     doQuery("c!doc2", "q","*:*", "shards",bucket2);
-    doQuery("d!doc3,f1!f2!doc5", "q","*:*", "shards",bucket3);
+    doQuery("d!doc3,f1!f2!doc5,f1!f2!doc5/5", "q","*:*", "shards",bucket3);
     doQuery("e!doc4", "q","*:*", "shards",bucket4);
 
 
@@ -181,16 +184,16 @@ public class ShardRoutingTest extends Ab
     doQuery("b!doc1,c!doc2", "q","*:*", shardKeys,"b,c");     // query shards that would
contain *documents* "b" and "c" (i.e. not prefixes).  The upper bits are the same, so the
shards should be the same.
 
     doQuery("b!doc1,c!doc2", "q","*:*", shardKeys,"b/1!");   // top bit of hash(b)==1, so
shard1 and shard2
-    doQuery("d!doc3,e!doc4,f1!f2!doc5", "q","*:*", shardKeys,"d/1!");   // top bit of hash(b)==0,
so shard3 and shard4
+    doQuery("d!doc3,e!doc4,f1!f2!doc5,f1!f2!doc5/5", "q","*:*", shardKeys,"d/1!");   // top
bit of hash(b)==0, so shard3 and shard4
 
     doQuery("b!doc1,c!doc2", "q","*:*", shardKeys,"b!,c!");
 
-    doQuery("b!doc1,f1!f2!doc5,c!doc2,d!doc3,e!doc4", "q","*:*", shardKeys,"foo/0!");
+    doQuery("b!doc1,f1!f2!doc5,c!doc2,d!doc3,e!doc4,f1!f2!doc5/5", "q","*:*", shardKeys,"foo/0!");
 
     // test targeting deleteByQuery at only certain shards
     doDBQ("*:*", shardKeys,"b!");
     commit();
-    doQuery("c!doc2,d!doc3,e!doc4,f1!f2!doc5", "q","*:*");
+    doQuery("c!doc2,d!doc3,e!doc4,f1!f2!doc5,f1!f2!doc5/5", "q","*:*");
     doAddDoc("b!doc1");
 
     doDBQ("*:*", shardKeys,"f1!");

Modified: lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/TriLevelCompositeIdRoutingTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/TriLevelCompositeIdRoutingTest.java?rev=1547461&r1=1547460&r2=1547461&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/TriLevelCompositeIdRoutingTest.java
(original)
+++ lucene/dev/branches/branch_4x/solr/core/src/test/org/apache/solr/cloud/TriLevelCompositeIdRoutingTest.java
Tue Dec  3 16:25:34 2013
@@ -143,7 +143,6 @@ public class TriLevelCompositeIdRoutingT
   Set<String> doQueryGetUniqueIdKeys(String... queryParams) throws Exception {
     QueryResponse rsp = cloudClient.query(params(queryParams));
     Set<String> obtainedIdKeys = new HashSet<String>();
-    Set<String> obtainedIdKeys2 = new HashSet<String>();
     for (SolrDocument doc : rsp.getResults()) {
       obtainedIdKeys.add(getKey((String) doc.get("id")));
     }

Modified: lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java?rev=1547461&r1=1547460&r2=1547461&view=diff
==============================================================================
--- lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java
(original)
+++ lucene/dev/branches/branch_4x/solr/solrj/src/java/org/apache/solr/common/cloud/CompositeIdRouter.java
Tue Dec  3 16:25:34 2013
@@ -202,15 +202,16 @@ public class CompositeIdRouter extends H
       } else {
         numBits[0] = 16;
         triLevel = false;
-
       }
 
       for (int i = 0; i < parts.length; i++) {
-        int commaIdx = parts[i].indexOf(bitsSeparator);
+        if (i < pieces - 1) {
+          int commaIdx = parts[i].indexOf(bitsSeparator);
 
-        if (commaIdx > 0) {
-          numBits[i] = getNumBits(parts[i], commaIdx);
-          parts[i] = parts[i].substring(0, commaIdx);
+          if (commaIdx > 0) {
+            numBits[i] = getNumBits(parts[i], commaIdx);
+            parts[i] = parts[i].substring(0, commaIdx);
+          }
         }
         hashes[i] = Hash.murmurhash3_x86_32(parts[i], 0, parts[i].length(), 0);
       }



Mime
View raw message