lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rm...@apache.org
Subject svn commit: r1631928 [5/5] - in /lucene/dev/branches/lucene5969: ./ dev-tools/ dev-tools/idea/.idea/libraries/ lucene/ lucene/analysis/ lucene/analysis/common/ lucene/analysis/common/src/java/org/apache/lucene/analysis/standard/ lucene/analysis/common/...
Date Wed, 15 Oct 2014 01:26:31 GMT
Modified: lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/Grouping.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/Grouping.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/Grouping.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/Grouping.java Wed Oct 15 01:26:26 2014
@@ -27,6 +27,7 @@ import java.util.Map;
 import java.util.Set;
 
 import org.apache.commons.lang.ArrayUtils;
+import org.apache.lucene.index.ExitableDirectoryReader;
 import org.apache.lucene.index.StorableField;
 import org.apache.lucene.queries.function.FunctionQuery;
 import org.apache.lucene.queries.function.ValueSource;
@@ -452,6 +453,9 @@ public class Grouping {
     } catch (TimeLimitingCollector.TimeExceededException x) {
       logger.warn( "Query: " + query + "; " + x.getMessage() );
       qr.setPartialResults(true);
+    } catch (ExitableDirectoryReader.ExitingReaderException e) {
+      logger.warn( "Query: " + query + "; " + e.getMessage() );
+      qr.setPartialResults(true);
     }
   }
 

Modified: lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/SolrIndexSearcher.java Wed Oct 15 01:26:26 2014
@@ -232,16 +232,22 @@ public class SolrIndexSearcher extends I
     catch( TimeLimitingCollector.TimeExceededException x ) {
       log.warn( "Query: " + query + "; " + x.getMessage() );
       qr.setPartialResults(true);
-    }        
+    } catch ( ExitableDirectoryReader.ExitingReaderException e) {
+      log.warn("Query: " + query + "; " + e.getMessage());
+      qr.setPartialResults(true);
+    }
   }
   
-  public SolrIndexSearcher(SolrCore core, String path, IndexSchema schema, SolrIndexConfig config, String name, boolean enableCache, DirectoryFactory directoryFactory) throws IOException {
+  public SolrIndexSearcher(SolrCore core, String path, IndexSchema schema, SolrIndexConfig config, String name,
+                           boolean enableCache, DirectoryFactory directoryFactory) throws IOException {
     // we don't need to reserve the directory because we get it from the factory
-    this(core, path, schema, config, name, getReader(core, config, directoryFactory, path), true, enableCache, false, directoryFactory);
+    this(core, path, schema, name, getReader(core, config, directoryFactory, path), true, enableCache, false, directoryFactory);
     this.createdDirectory = true;
   }
 
-  public SolrIndexSearcher(SolrCore core, String path, IndexSchema schema, SolrIndexConfig config, String name, DirectoryReader r, boolean closeReader, boolean enableCache, boolean reserveDirectory, DirectoryFactory directoryFactory) throws IOException {
+  public SolrIndexSearcher(SolrCore core, String path, IndexSchema schema, String name, DirectoryReader r,
+                           boolean closeReader, boolean enableCache, boolean reserveDirectory,
+                           DirectoryFactory directoryFactory) throws IOException {
     super(wrapReader(core, r));
 
     this.path = path;
@@ -1214,11 +1220,15 @@ public class SolrIndexSearcher extends I
   protected DocSet getDocSetNC(Query query, DocSet filter) throws IOException {
     DocSetCollector collector = new DocSetCollector(maxDoc()>>6, maxDoc());
 
-    if (filter==null) {
-      super.search(query,null,collector);
-    } else {
-      Filter luceneFilter = filter.getTopFilter();
-      super.search(query, luceneFilter, collector);
+    try {
+      if (filter == null) {
+        super.search(query, null, collector);
+      } else {
+        Filter luceneFilter = filter.getTopFilter();
+        super.search(query, luceneFilter, collector);
+      }
+    } catch ( ExitableDirectoryReader.ExitingReaderException e) {
+        log.warn("Query: " + query + "; " + e.getMessage());
     }
     return collector.getDocSet();
   }

Modified: lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/function/distance/StringDistanceFunction.java Wed Oct 15 01:26:26 2014
@@ -51,7 +51,18 @@ public class StringDistanceFunction exte
 
       @Override
       public float floatVal(int doc) {
-        return dist.getDistance(str1DV.strVal(doc), str2DV.strVal(doc));
+        String s1 = str1DV.strVal(doc);
+        String s2 = str2DV.strVal(doc);
+        if (null == s1 || null == s2) {
+          // the only thing a missing value scores 1.0 with is another missing value
+          return (s1 == s2) ? 1.0F : 0.0F;
+        }
+        return dist.getDistance(s1, s2);
+      }
+
+      @Override
+      public boolean exists(int doc) {
+        return str1DV.exists(doc) && str2DV.exists(doc);
       }
 
       @Override

Modified: lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/grouping/CommandHandler.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/grouping/CommandHandler.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/grouping/CommandHandler.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/search/grouping/CommandHandler.java Wed Oct 15 01:26:26 2014
@@ -22,6 +22,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 
+import org.apache.lucene.index.ExitableDirectoryReader;
 import org.apache.lucene.queries.function.ValueSource;
 import org.apache.lucene.search.Collector;
 import org.apache.lucene.search.Filter;
@@ -230,6 +231,9 @@ public class CommandHandler {
     } catch (TimeLimitingCollector.TimeExceededException x) {
       partialResults = true;
       logger.warn( "Query: " + query + "; " + x.getMessage() );
+    } catch (ExitableDirectoryReader.ExitingReaderException e) {
+      partialResults = true;
+      logger.warn( "Query: " + query + "; " + e.getMessage() );
     }
 
     if (includeHitCount) {

Modified: lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java Wed Oct 15 01:26:26 2014
@@ -868,17 +868,16 @@ public class DistributedUpdateProcessor 
             if (sendRecoveryCommand) {
               maxTries = 120;
             } // else the node is no longer "live" so no need to send any recovery command
-
-          } catch (KeeperException.SessionExpiredException see) {
-            log.error("Leader failed to set replica " +
-                error.req.node.getUrl() + " state to DOWN due to: " + see, see);
-            // our session is expired, which means our state is suspect, so don't go
-            // putting other replicas in recovery (see SOLR-6511)
-            sendRecoveryCommand = false;
-          } catch (Exception e) {
+          } catch (Exception exc) {
+            Throwable setLirZnodeFailedCause = SolrException.getRootCause(exc);
             log.error("Leader failed to set replica " +
-                error.req.node.getUrl() + " state to DOWN due to: " + e, e);
-            // will go ahead and try to send the recovery command once after this error
+                error.req.node.getUrl() + " state to DOWN due to: " + setLirZnodeFailedCause, setLirZnodeFailedCause);
+            if (setLirZnodeFailedCause instanceof KeeperException.SessionExpiredException ||
+                setLirZnodeFailedCause instanceof KeeperException.ConnectionLossException) {
+              // our session is expired, which means our state is suspect, so don't go
+              // putting other replicas in recovery (see SOLR-6511)
+              sendRecoveryCommand = false;
+            } // else will go ahead and try to send the recovery command once after this error
           }
         } else {
           // not the leader anymore maybe or the error'd node is not my replica?

Modified: lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/update/processor/RunUpdateProcessorFactory.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/update/processor/RunUpdateProcessorFactory.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/update/processor/RunUpdateProcessorFactory.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/java/org/apache/solr/update/processor/RunUpdateProcessorFactory.java Wed Oct 15 01:26:26 2014
@@ -63,7 +63,7 @@ class RunUpdateProcessor extends UpdateR
     if (DistributedUpdateProcessor.isAtomicUpdate(cmd)) {
       throw new SolrException
         (SolrException.ErrorCode.BAD_REQUEST,
-         "RunUpdateProcessor has recieved an AddUpdateCommand containing a document that appears to still contain Atomic document update operations, most likely because DistributedUpdateProcessorFactory was explicitly disabled from this updateRequestProcessorChain");
+         "RunUpdateProcessor has received an AddUpdateCommand containing a document that appears to still contain Atomic document update operations, most likely because DistributedUpdateProcessorFactory was explicitly disabled from this updateRequestProcessorChain");
     }
 
     updateHandler.addDoc(cmd);

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/TestDistributedSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/TestDistributedSearch.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/TestDistributedSearch.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/TestDistributedSearch.java Wed Oct 15 01:26:26 2014
@@ -17,6 +17,7 @@
 
 package org.apache.solr;
 
+import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -443,6 +444,16 @@ public class TestDistributedSearch exten
     query("q", "id:[1 TO 5]", CommonParams.DEBUG, CommonParams.RESULTS);
     query("q", "id:[1 TO 5]", CommonParams.DEBUG, CommonParams.QUERY);
 
+    // SOLR-6545, wild card field list
+    indexr(id, "19", "text", "d", "cat_a_sS", "1" ,t1, "2");
+    commit();
+
+    rsp = query("q", "id:19", "fl", "id", "fl", "*a_sS");
+    assertFieldValues(rsp.getResults(), "id", 19);
+
+    rsp = query("q", "id:19", "fl", "id," + t1 + ",cat*");
+    assertFieldValues(rsp.getResults(), "id", 19);
+
     // Check Info is added to for each shard
     ModifiableSolrParams q = new ModifiableSolrParams();
     q.set("q", "*:*");
@@ -492,24 +503,17 @@ public class TestDistributedSearch exten
           ShardParams.SHARDS_TOLERANT, "true");
 
       // test group query
-      // TODO: Remove this? This doesn't make any real sense now that timeAllowed might trigger early
-      //       termination of the request during Terms enumeration/Query expansion.
-      //       During such an exit, partial results isn't supported as it wouldn't make any sense.
-      // Increasing the timeAllowed from 1 to 100 for now.
-      //
-      // TODO: still failing in jenkins - see SOLR-5986
-      //
-      // queryPartialResults(upShards, upClients,
-      //     "q", "*:*",
-      //     "rows", 100,
-      //     "fl", "id," + i1,
-      //     "group", "true",
-      //     "group.query", t1 + ":kings OR " + t1 + ":eggs",
-      //     "group.limit", 10,
-      //     "sort", i1 + " asc, id asc",
-      //     CommonParams.TIME_ALLOWED, 100,
-      //     ShardParams.SHARDS_INFO, "true",
-      //     ShardParams.SHARDS_TOLERANT, "true");
+      queryPartialResults(upShards, upClients,
+           "q", "*:*",
+           "rows", 100,
+           "fl", "id," + i1,
+           "group", "true",
+           "group.query", t1 + ":kings OR " + t1 + ":eggs",
+           "group.limit", 10,
+           "sort", i1 + " asc, id asc",
+           CommonParams.TIME_ALLOWED, 1,
+           ShardParams.SHARDS_INFO, "true",
+           ShardParams.SHARDS_TOLERANT, "true");
 
       queryPartialResults(upShards, upClients,
           "q", "*:*",

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/TestGroupingSearch.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/TestGroupingSearch.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/TestGroupingSearch.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/TestGroupingSearch.java Wed Oct 15 01:26:26 2014
@@ -278,9 +278,7 @@ public class TestGroupingSearch extends 
     assertU(commit());
 
     // Just checking if no errors occur
-    // TODO: Check if this makes any sense now that timeAllowed is also used during Terms enumeration.
-    //       The query can potentially timeout iterating over terms if this is set to too low.
-    assertJQ(req("q", "*:*", "group", "true", "group.query", "id:1", "group.query", "id:2", "timeAllowed", "100"));
+    assertJQ(req("q", "*:*", "group", "true", "group.query", "id:1", "group.query", "id:2", "timeAllowed", "1"));
   }
 
   @Test

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/CloudExitableDirectoryReaderTest.java Wed Oct 15 01:26:26 2014
@@ -20,15 +20,11 @@ package org.apache.solr.cloud;
 
 import org.apache.lucene.util.LuceneTestCase.Slow;
 import org.apache.lucene.util.TestUtil;
-import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.response.QueryResponse;
-import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.ModifiableSolrParams;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import static org.apache.solr.common.SolrException.ErrorCode;
-
 /**
 * Distributed test for {@link org.apache.lucene.index.ExitableDirectoryReader} 
 */
@@ -36,7 +32,7 @@ import static org.apache.solr.common.Sol
 public class CloudExitableDirectoryReaderTest extends AbstractFullDistribZkTestBase {
   public static Logger log = LoggerFactory.getLogger(CloudExitableDirectoryReaderTest.class);
   private static final int NUM_DOCS_PER_TYPE = 20;
-
+  
   public CloudExitableDirectoryReaderTest() {
     configString = "solrconfig-tlog-with-delayingcomponent.xml";
     schemaString = "schema.xml";
@@ -74,7 +70,7 @@ public class CloudExitableDirectoryReade
   }
 
   public void doTimeoutTests() throws Exception {
-    assertFail(params("q", "name:a*", "timeAllowed", "1"));
+    assertPartialResults(params("q", "name:a*", "timeAllowed", "1"));
 
     /*
     query rewriting for NUM_DOCS_PER_TYPE terms should take less 
@@ -86,7 +82,7 @@ public class CloudExitableDirectoryReade
     Long timeAllowed = TestUtil.nextLong(random(), fiveSeconds, Long.MAX_VALUE);
     assertSuccess(params("q", "name:a*", "timeAllowed",timeAllowed.toString()));
 
-    assertFail(params("q", "name:a*", "timeAllowed", "1"));
+    assertPartialResults(params("q", "name:a*", "timeAllowed", "1"));
 
     timeAllowed = TestUtil.nextLong(random(), fiveSeconds, Long.MAX_VALUE);
     assertSuccess(params("q", "name:b*", "timeAllowed",timeAllowed.toString()));
@@ -100,37 +96,14 @@ public class CloudExitableDirectoryReade
   /**
    * execute a request, verify that we get an expected error
    */
-  public void assertFail(ModifiableSolrParams p) throws Exception {
-    String timeoutMessage = "Request took too long during query expansion. Terminating request.";
-
-    try {
-      ignoreException(timeoutMessage);
-      queryServer(p);
-      fail("no exception matching expected: " + ErrorCode.BAD_REQUEST.code + ": " + timeoutMessage);
-    } catch (SolrServerException e) {
-      assertTrue("Exception " + e.getCause() + " is not a SolrException:\n" + prettyStackTrace(e.getCause()),
-          e.getCause() instanceof SolrException);
-      assertEquals(ErrorCode.BAD_REQUEST.code, ((SolrException)e.getCause()).code());
-      assertTrue("Expected error message substr not found: " + timeoutMessage + " <!< " + e.getMessage(),
-                 e.getMessage().contains(timeoutMessage));
-    } finally {
-      unIgnoreException(timeoutMessage);
-    }
+  public void assertPartialResults(ModifiableSolrParams p) throws Exception {
+      QueryResponse rsp = queryServer(p);
+      assertEquals("partialResults were expected", true, rsp.getHeader().get("partialResults"));
   }
   
   public void assertSuccess(ModifiableSolrParams p) throws Exception {
     QueryResponse response = queryServer(p);
     assertEquals("Wrong #docs in response", NUM_DOCS_PER_TYPE - 1, response.getResults().getNumFound());
   }
-
-  public String prettyStackTrace(Throwable t) {
-    StringBuilder builder = new StringBuilder();
-    for (StackTraceElement elem : t.getStackTrace()) {
-      builder.append("    at ");
-      builder.append(elem.toString());
-      builder.append('\n');
-    }
-    return builder.toString();
-  }
 }
 

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/CollectionsAPIDistributedZkTest.java Wed Oct 15 01:26:26 2014
@@ -1266,7 +1266,7 @@ public class CollectionsAPIDistributedZk
       createCollection(collectionName, client, 2, 2);
       String newReplicaName = Assign.assignNode(collectionName, client.getZkStateReader().getClusterState());
       ArrayList<String> nodeList = new ArrayList<>(client.getZkStateReader().getClusterState().getLiveNodes());
-      Collections.shuffle(nodeList);
+      Collections.shuffle(nodeList, random());
       CollectionAdminRequest.AddReplica addReplica = new CollectionAdminRequest.AddReplica();
       addReplica.setCollectionName(collectionName);
       addReplica.setShardName("shard1");

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/HttpPartitionTest.java Wed Oct 15 01:26:26 2014
@@ -117,6 +117,10 @@ public class HttpPartitionTest extends A
 
     // have the leader lose its Zk session temporarily
     testLeaderZkSessionLoss();
+
+    waitForThingsToLevelOut(30000);
+
+    log.info("HttpParitionTest succeeded ... shutting down now!");
   }
   
   protected void testRf2() throws Exception {
@@ -187,6 +191,8 @@ public class HttpPartitionTest extends A
     // verify all docs received
     assertDocsExistInAllReplicas(notLeaders, testCollectionName, 1, numDocs + 3);
 
+    log.info("testRf2 succeeded ... deleting the "+testCollectionName+" collection");
+
     // try to clean up
     try {
       CollectionAdminRequest req = new CollectionAdminRequest.Delete();
@@ -240,6 +246,9 @@ public class HttpPartitionTest extends A
     sendDoc(4);
     
     assertDocsExistInAllReplicas(notLeaders, testCollectionName, 1, 4);
+
+    log.info("testRf3 succeeded ... deleting the "+testCollectionName+" collection");
+
     // try to clean up
     try {
       CollectionAdminRequest req = new CollectionAdminRequest.Delete();
@@ -334,6 +343,8 @@ public class HttpPartitionTest extends A
     waitToSeeReplicasActive(testCollectionName, "shard1", replicasToCheck, 20);
     assertDocsExistInAllReplicas(participatingReplicas, testCollectionName, 1, 2);
 
+    log.info("testLeaderZkSessionLoss succeeded ... deleting the "+testCollectionName+" collection");
+
     // try to clean up
     try {
       CollectionAdminRequest req = new CollectionAdminRequest.Delete();

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/OverseerRolesTest.java Wed Oct 15 01:26:26 2014
@@ -137,7 +137,7 @@ public class OverseerRolesTest  extends 
     log.info("Current leader {} ", currentLeader);
     l.remove(currentLeader);
 
-    Collections.shuffle(l);
+    Collections.shuffle(l, random());
     String overseerDesignate = l.get(0);
     log.info("overseerDesignate {}",overseerDesignate);
     setOverseerRole(CollectionAction.ADDROLE,overseerDesignate);
@@ -165,7 +165,7 @@ public class OverseerRolesTest  extends 
 
     l.remove(overseerDesignate);
 
-    Collections.shuffle(l);
+    Collections.shuffle(l, random());
 
     String anotherOverseer = l.get(0);
     log.info("Adding another overseer designate {}", anotherOverseer);

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/ReplicationFactorTest.java Wed Oct 15 01:26:26 2014
@@ -43,13 +43,14 @@ import org.junit.Before;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+//@AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-6157")
+
 /**
  * Tests a client application's ability to get replication factor
  * information back from the cluster after an add or update.
  */
 @Slow
 @SuppressSSL(bugUrl = "https://issues.apache.org/jira/browse/SOLR-5776")
-@AwaitsFix(bugUrl = "https://issues.apache.org/jira/browse/SOLR-6157")
 public class ReplicationFactorTest extends AbstractFullDistribZkTestBase {
   
   private static final transient Logger log = 
@@ -140,6 +141,8 @@ public class ReplicationFactorTest exten
     log.info("Testing replication factor handling for repfacttest_c8n_1x3");
     testRf3();
 
+    waitForThingsToLevelOut(30000);
+
     // test handling when not using direct updates
     log.info("Now testing replication factor handling for repfacttest_c8n_2x2");
     testRf2NotUsingDirectUpdates();

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/cloud/TestCollectionAPI.java Wed Oct 15 01:26:26 2014
@@ -19,7 +19,6 @@ package org.apache.solr.cloud;
 
 
 import com.google.common.collect.Lists;
-import org.apache.commons.lang.StringUtils;
 import org.apache.solr.client.solrj.SolrRequest;
 import org.apache.solr.client.solrj.SolrServerException;
 import org.apache.solr.client.solrj.impl.CloudSolrServer;
@@ -45,7 +44,7 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 
-public class TestCollectionAPI extends AbstractFullDistribZkTestBase {
+public class TestCollectionAPI extends ReplicaPropertiesBase {
 
   public static final String COLLECTION_NAME = "testcollection";
   public static final String COLLECTION_NAME1 = "testcollection1";
@@ -338,9 +337,7 @@ public class TestCollectionAPI extends A
 
       // The above should have set exactly one preferredleader...
       verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader", "true");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r2, "property.preferredLeader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r1, "property.preferredLeader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredLeader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
 
       doPropertyAction(client,
           "action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
@@ -351,9 +348,7 @@ public class TestCollectionAPI extends A
           "property.value", "true");
       // The preferred leader property for shard1 should have switched to the other replica.
       verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredLeader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r1, "property.preferredLeader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredLeader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
 
       doPropertyAction(client,
           "action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
@@ -365,9 +360,8 @@ public class TestCollectionAPI extends A
 
       // Now we should have a preferred leader in both shards...
       verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
       verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredLeader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
 
       doPropertyAction(client,
           "action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
@@ -381,6 +375,8 @@ public class TestCollectionAPI extends A
       verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
       verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
       verifyPropertyVal(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader", "true");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
 
       doPropertyAction(client,
           "action", CollectionParams.CollectionAction.DELETEREPLICAPROP.toString(),
@@ -393,9 +389,8 @@ public class TestCollectionAPI extends A
       // But first we have to wait for the overseer to finish the action
       verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
       verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
 
       // Try adding an arbitrary property to one that has the leader property
       doPropertyAction(client,
@@ -409,10 +404,8 @@ public class TestCollectionAPI extends A
       verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.preferredleader", "true");
       verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
       verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.testprop", "true");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
 
       doPropertyAction(client,
           "action", CollectionParams.CollectionAction.ADDREPLICAPROP.toString(),
@@ -426,10 +419,8 @@ public class TestCollectionAPI extends A
       verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
       verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.testprop", "true");
       verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.prop", "silly");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
 
       doPropertyAction(client,
           "action", CollectionParams.CollectionAction.ADDREPLICAPROP.toLower(),
@@ -444,10 +435,8 @@ public class TestCollectionAPI extends A
       verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
       verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.testprop", "nonsense");
       verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.prop", "silly");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
 
 
       doPropertyAction(client,
@@ -463,10 +452,8 @@ public class TestCollectionAPI extends A
       verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
       verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r1, "property.testprop", "true");
       verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.prop", "silly");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
 
       doPropertyAction(client,
           "action", CollectionParams.CollectionAction.DELETEREPLICAPROP.toLower(),
@@ -479,10 +466,8 @@ public class TestCollectionAPI extends A
       verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
       verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.testprop");
       verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.prop", "silly");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
 
       try {
         doPropertyAction(client,
@@ -503,10 +488,8 @@ public class TestCollectionAPI extends A
       verifyPropertyVal(client, COLLECTION_NAME, c1_s2_r1, "property.preferredleader", "true");
       verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.testprop");
       verifyPropertyVal(client, COLLECTION_NAME, c1_s1_r2, "property.prop", "silly");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s1_r1, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME, c1_s2_r2, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
-      verifyPropertyNotPresent(client, COLLECTION_NAME1, c2_s1_r1, "property.preferredleader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME, "property.preferredLeader");
+      verifyUniquePropertyWithinCollection(client, COLLECTION_NAME1, "property.preferredLeader");
 
       Map<String, String> origProps = getProps(client, COLLECTION_NAME, c1_s1_r1,
           "state", "core", "node_name", "base_url");
@@ -592,68 +575,11 @@ public class TestCollectionAPI extends A
     }
   }
 
-  private void doPropertyAction(CloudSolrServer client, String... paramsIn) throws IOException, SolrServerException {
-    assertTrue("paramsIn must be an even multiple of 2, it is: " + paramsIn.length, (paramsIn.length % 2) == 0);
-    ModifiableSolrParams params = new ModifiableSolrParams();
-    for (int idx = 0; idx < paramsIn.length; idx += 2) {
-      params.set(paramsIn[idx], paramsIn[idx + 1]);
-    }
-    QueryRequest request = new QueryRequest(params);
-    request.setPath("/admin/collections");
-    client.request(request);
-
-  }
 
-  private void verifyPropertyNotPresent(CloudSolrServer client, String collectionName, String replicaName,
-                                        String property)
+  // Expects the map will have keys, but blank values.
+  private Map<String, String> getProps(CloudSolrServer client, String collectionName, String replicaName, String... props)
       throws KeeperException, InterruptedException {
-    ClusterState clusterState = null;
-    Replica replica = null;
-    for (int idx = 0; idx < 300; ++idx) {
-      client.getZkStateReader().updateClusterState(true);
-      clusterState = client.getZkStateReader().getClusterState();
-      replica = clusterState.getReplica(collectionName, replicaName);
-      if (replica == null) {
-        fail("Could not find collection/replica pair! " + collectionName + "/" + replicaName);
-      }
-      if (StringUtils.isBlank(replica.getStr(property))) return;
-      Thread.sleep(100);
-    }
-    fail("Property " + property + " not set correctly for collection/replica pair: " +
-        collectionName + "/" + replicaName + ". Replica props: " + replica.getProperties().toString() +
-        ". Cluster state is " + clusterState.toString());
-
-  }
 
-  // The params are triplets,
-  // collection
-  // shard
-  // replica
-  private void verifyPropertyVal(CloudSolrServer client, String collectionName,
-                                 String replicaName, String property, String val)
-      throws InterruptedException, KeeperException {
-    Replica replica = null;
-    ClusterState clusterState = null;
-
-    for (int idx = 0; idx < 300; ++idx) { // Keep trying while Overseer writes the ZK state for up to 30 seconds.
-      client.getZkStateReader().updateClusterState(true);
-      clusterState = client.getZkStateReader().getClusterState();
-      replica = clusterState.getReplica(collectionName, replicaName);
-      if (replica == null) {
-        fail("Could not find collection/replica pair! " + collectionName + "/" + replicaName);
-      }
-      if (StringUtils.equals(val, replica.getStr(property))) return;
-      Thread.sleep(100);
-    }
-
-    fail("Property '" + property + "' with value " + replica.getStr(property) +
-        " not set correctly for collection/replica pair: " + collectionName + "/" + replicaName + " property map is " +
-        replica.getProperties().toString() + ".");
-
-  }
-
-  // Expects the map will have keys, but blank values.
-  private Map<String, String> getProps(CloudSolrServer client, String collectionName, String replicaName, String... props) throws KeeperException, InterruptedException {
     client.getZkStateReader().updateClusterState(true);
     ClusterState clusterState = client.getZkStateReader().getClusterState();
     Replica replica = clusterState.getReplica(collectionName, replicaName);

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/core/ExitableDirectoryReaderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/core/ExitableDirectoryReaderTest.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/core/ExitableDirectoryReaderTest.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/core/ExitableDirectoryReaderTest.java Wed Oct 15 01:26:26 2014
@@ -20,6 +20,8 @@ package org.apache.solr.core;
 
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrException;
+import org.apache.solr.request.SolrQueryRequest;
+import org.apache.solr.response.SolrQueryResponse;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -31,6 +33,7 @@ public class ExitableDirectoryReaderTest
   
   static int NUM_DOCS_PER_TYPE = 100;
   static final String assertionString = "//result[@numFound='"+ (NUM_DOCS_PER_TYPE - 1) + "']";
+  static final String failureAssertionString = "/responseHeader/partialResults==true]";
 
   @BeforeClass
   public static void beforeClass() throws Exception {
@@ -57,16 +60,12 @@ public class ExitableDirectoryReaderTest
   }
 
   @Test
-  public void testPrefixQuery() {
-    assertQEx("", req("q","name:a*", "indent","true","timeAllowed","1")
-        , SolrException.ErrorCode.BAD_REQUEST
-    );
+  public void testPrefixQuery() throws Exception {
+    assertJQ(req("q", "name:a*", "indent", "true", "timeAllowed", "1"), failureAssertionString);
 
     assertQ(req("q","name:a*", "indent","true", "timeAllowed","10000"), assertionString);
 
-    assertQEx("", req("q","name:a*", "indent","true", "timeAllowed","1")
-        , SolrException.ErrorCode.BAD_REQUEST
-    );
+    assertJQ(req("q","name:a*", "indent","true", "timeAllowed","1"), failureAssertionString);
 
     assertQ(req("q","name:b*", "indent","true", "timeAllowed","10000"), assertionString);
 
@@ -78,18 +77,16 @@ public class ExitableDirectoryReaderTest
   }
   
   @Test
-  public void testQueriesOnDocsWithMultipleTerms() {
+  public void testQueriesOnDocsWithMultipleTerms() throws Exception {
     assertQ(req("q","name:dummy", "indent","true", "timeAllowed","10000"), assertionString);
 
     // This should pass even though this may take more than the 'timeAllowed' time, it doesn't take long
     // to iterate over 1 term (dummy).
-    assertQ(req("q","name:dummy", "indent","true", "timeAllowed","10000"), assertionString);
-
-    assertQEx("", req("q","name:doc*", "indent","true", "timeAllowed","1")
-        , SolrException.ErrorCode.BAD_REQUEST
-    );
+    assertQ(req("q", "name:dummy", "indent", "true", "timeAllowed", "10000"), assertionString);
 
+    assertJQ(req("q", "name:doc*", "indent", "true", "timeAllowed", "1"), failureAssertionString);
   }
+  
 }
 
 

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentOptimizationTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentOptimizationTest.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentOptimizationTest.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/handler/component/DistributedQueryComponentOptimizationTest.java Wed Oct 15 01:26:26 2014
@@ -97,6 +97,24 @@ public class DistributedQueryComponentOp
     verifySinglePass("q", "*:*", "fl", "id", "sort", "payload desc", "rows", "20"); // id only is optimized by default
     verifySinglePass("q", "*:*", "fl", "id,score", "sort", "payload desc", "rows", "20"); // id,score only is optimized by default
     verifySinglePass("q", "*:*", "fl", "score", "sort", "payload asc", "rows", "20", "distrib.singlePass", "true");
+
+    // SOLR-6545, wild card field list
+    index(id, "19", "text", "d", "cat_a_sS", "1" ,"dynamic", "2", "payload", ByteBuffer.wrap(new byte[] { (byte)0x80, 0x11, 0x33 }));
+    commit();
+
+    nonDistribRsp = query("q", "id:19", "fl", "id,*a_sS", "sort", "payload asc");
+    rsp = query("q", "id:19", "fl", "id,*a_sS", "sort", "payload asc", "distrib.singlePass", "true");
+
+    assertFieldValues(nonDistribRsp.getResults(), "id", 19);
+    assertFieldValues(rsp.getResults(), "id", 19);
+
+    nonDistribRsp = query("q", "id:19", "fl", "id,dynamic,cat*", "sort", "payload asc");
+    rsp = query("q", "id:19", "fl", "id,dynamic,cat*", "sort", "payload asc", "distrib.singlePass", "true");
+    assertFieldValues(nonDistribRsp.getResults(), "id", 19);
+    assertFieldValues(rsp.getResults(), "id", 19);
+
+    verifySinglePass("q", "id:19", "fl", "id,*a_sS", "sort", "payload asc", "distrib.singlePass", "true");
+    verifySinglePass("q", "id:19", "fl", "id,dynamic,cat*", "sort", "payload asc", "distrib.singlePass", "true");
   }
 
   private void verifySinglePass(String... q) throws SolrServerException {

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/handler/component/StatsComponentTest.java Wed Oct 15 01:26:26 2014
@@ -379,14 +379,13 @@ public class StatsComponentTest extends 
     // stats over a string function
     assertQ("strdist func stats",
             req("q", "*:*",
-                "fq", "-id:4", // SOLR-6540
                 "stats","true",
                 "stats.field","{!func}strdist('string22',active_s,edit)")
             , "//double[@name='min'][.='0.75']"
             , "//double[@name='max'][.='0.875']"
             , "//double[@name='sum'][.='2.375']"
             , "//long[@name='count'][.='3']"
-            ,"//long[@name='missing'][.='0']" // SOLR-6540 ==> '1'
+            ,"//long[@name='missing'][.='1']"
             );
 
   }

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/rest/schema/TestBulkSchemaAPI.java Wed Oct 15 01:26:26 2014
@@ -19,7 +19,6 @@ package org.apache.solr.rest.schema;
 
 import org.apache.commons.io.FileUtils;
 import org.apache.solr.SolrTestCaseJ4;
-import org.apache.solr.schema.SchemaManager;
 import org.apache.solr.util.RestTestBase;
 import org.apache.solr.util.RestTestHarness;
 import org.eclipse.jetty.servlet.ServletHolder;
@@ -98,10 +97,10 @@ public class TestBulkSchemaAPI extends R
     Map map = (Map) ObjectBuilder.getVal(new JSONParser(new StringReader(response)));
     List l = (List) map.get("errors");
 
-    List errorList = (List) ((Map) l.get(0)).get(SchemaManager.ERR_MSGS);
+    List errorList = (List) ((Map) l.get(0)).get("errorMessages");
     assertEquals(1, errorList.size());
     assertTrue (((String)errorList.get(0)).contains("No such field type"));
-    errorList = (List) ((Map) l.get(1)).get(SchemaManager.ERR_MSGS);
+    errorList = (List) ((Map) l.get(1)).get("errorMessages");
     assertEquals(1, errorList.size());
     assertTrue (((String)errorList.get(0)).contains("is a required field"));
 

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/schema/TestSchemaManager.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/schema/TestSchemaManager.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/schema/TestSchemaManager.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/schema/TestSchemaManager.java Wed Oct 15 01:26:26 2014
@@ -18,6 +18,7 @@ package org.apache.solr.schema;
  */
 
 import org.apache.solr.SolrTestCaseJ4;
+import org.apache.solr.util.CommandOperation;
 import org.junit.BeforeClass;
 import org.junit.Test;
 
@@ -49,9 +50,9 @@ public class TestSchemaManager extends S
         "\n" +
         "}";
 
-    List<SchemaManager.Operation> ops = SchemaManager.parse(new StringReader(x));
+    List<CommandOperation> ops = CommandOperation.parse(new StringReader(x));
     assertEquals(2,ops.size());
-    assertTrue( SchemaManager.captureErrors(ops).isEmpty());
+    assertTrue( CommandOperation.captureErrors(ops).isEmpty());
 
     x = " {\"add-field\" : [{\n" +
         "                                 \"name\":\"a1\",\n" +
@@ -66,9 +67,9 @@ public class TestSchemaManager extends S
         "                             \"indexed\":true\n" +
         "                             }]\n" +
         "           }";
-    ops = SchemaManager.parse(new StringReader(x));
+    ops = CommandOperation.parse(new StringReader(x));
     assertEquals(2,ops.size());
-    assertTrue( SchemaManager.captureErrors(ops).isEmpty());
+    assertTrue( CommandOperation.captureErrors(ops).isEmpty());
 
   }
 

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/search/function/TestFunctionQuery.java Wed Oct 15 01:26:26 2014
@@ -554,6 +554,29 @@ public class TestFunctionQuery extends S
     assertQ(req("fl", "*,score", "q", "{!func}strdist(x_s, 'foit', edit)", "fq", "id:1"), "//float[@name='score']='0.75'");
     assertQ(req("fl", "*,score", "q", "{!func}strdist(x_s, 'foit', jw)", "fq", "id:1"), "//float[@name='score']='0.8833333'");
     assertQ(req("fl", "*,score", "q", "{!func}strdist(x_s, 'foit', ngram, 2)", "fq", "id:1"), "//float[@name='score']='0.875'");
+
+    // strdist on a missing valuesource should itself by missing, so the ValueSourceAugmenter 
+    // should supress it...
+    assertQ(req("q", "id:1",
+                "fl", "good:strdist(x_s, 'toil', edit)", 
+                "fl", "bad1:strdist(missing1_s, missing2_s, edit)", 
+                "fl", "bad2:strdist(missing1_s, 'something', edit)", 
+                "fl", "bad3:strdist(missing1_s, x_s, edit)")
+            , "//float[@name='good']='0.75'"
+            , "count(//float[starts-with(@name,'bad')])=0"
+            );
+
+    // in a query context, there is always a number...
+    //
+    // if a ValueSource is missing, it is maximally distant from every other
+    // value source *except* for another missing value source 
+    // ie: strdist(null,null)==1 but strdist(null,anything)==0
+    assertQ(req("fl","score","fq", "id:1", "q", "{!func}strdist(missing1_s, missing2_s, edit)"), 
+            "//float[@name='score']='1.0'");
+    assertQ(req("fl","score","fq", "id:1", "q", "{!func}strdist(missing1_s, x_s, edit)"), 
+            "//float[@name='score']='0.0'");
+    assertQ(req("fl","score","fq", "id:1", "q", "{!func}strdist(missing1_s, 'const', edit)"), 
+            "//float[@name='score']='0.0'");
   }
 
   public void dofunc(String func, double val) throws Exception {

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/update/AddBlockUpdateTest.java Wed Oct 15 01:26:26 2014
@@ -198,7 +198,7 @@ public class AddBlockUpdateTest extends 
         block("Y"),
         block("Z")));
     
-    Collections.shuffle(blocks);
+    Collections.shuffle(blocks, random());
     
     log.trace("{}", blocks);
     

Modified: lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java (original)
+++ lucene/dev/branches/lucene5969/solr/core/src/test/org/apache/solr/update/DocumentBuilderTest.java Wed Oct 15 01:26:26 2014
@@ -306,7 +306,7 @@ public class DocumentBuilderTest extends
     assertEquals(1.0F,                    outText[3].boost(), 0.0F);
     assertEquals(1.0F,                    outText[4].boost(), 0.0F);
     
-    // copyField dest with no norms should not have recieved any boost
+    // copyField dest with no norms should not have received any boost
     assertEquals(1.0F, outNoNorms[0].boost(), 0.0F);
     assertEquals(1.0F, outNoNorms[1].boost(), 0.0F);
     

Modified: lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java (original)
+++ lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/client/solrj/impl/CloudSolrServer.java Wed Oct 15 01:26:26 2014
@@ -84,11 +84,12 @@ import org.slf4j.LoggerFactory;
  * 'id' - if this is not the case, you must set the right name
  * with {@link #setIdField(String)}.
  */
+@SuppressWarnings("serial")
 public class CloudSolrServer extends SolrServer {
-  private static final Logger log = LoggerFactory.getLogger(CloudSolrServer.class);
+  protected static final Logger log = LoggerFactory.getLogger(CloudSolrServer.class);
 
   private volatile ZkStateReader zkStateReader;
-  private String zkHost; // the zk server address
+  private String zkHost; // the zk server connect string
   private int zkConnectTimeout = 10000;
   private int zkClientTimeout = 10000;
   private volatile String defaultCollection;
@@ -187,6 +188,57 @@ public class CloudSolrServer extends Sol
   }
   
   /**
+   * Create a new client object using multiple string values in a Collection
+   * instead of a standard zkHost connection string. Note that this method will
+   * not be used if there is only one String argument - that will use
+   * {@link #CloudSolrServer(String)} instead.
+   * 
+   * @param zkHosts
+   *          A Java Collection (List, Set, etc) of HOST:PORT strings, one for
+   *          each host in the zookeeper ensemble. Note that with certain
+   *          Collection types like HashSet, the order of hosts in the final
+   *          connect string may not be in the same order you added them.
+   * @param chroot
+   *          A chroot value for zookeeper, starting with a forward slash. If no
+   *          chroot is required, use null.
+   * @throws IllegalArgumentException
+   *           if the chroot value does not start with a forward slash.
+   * @see #CloudSolrServer(String)
+   */
+  public CloudSolrServer(Collection<String> zkHosts, String chroot) {
+    
+    StringBuilder zkBuilder = new StringBuilder();
+    int lastIndexValue = zkHosts.size() - 1;
+    int i = 0;
+    for (String zkHost : zkHosts) {
+      zkBuilder.append(zkHost);
+      if (i < lastIndexValue) {
+        zkBuilder.append(",");
+      }
+      i++;
+    }
+    if (chroot != null) {
+      if (chroot.startsWith("/")) {
+        zkBuilder.append(chroot);
+      } else {
+        throw new IllegalArgumentException(
+            "The chroot must start with a forward slash.");
+      }
+    }
+    
+    /* Log the constructed connection string and then initialize. */
+    log.info("Final constructed zkHost string: " + zkBuilder.toString());
+    
+    this.zkHost = zkBuilder.toString();
+    this.myClient = HttpClientUtil.createClient(null);
+    this.lbServer = new LBHttpSolrServer(myClient);
+    this.lbServer.setRequestWriter(new BinaryRequestWriter());
+    this.lbServer.setParser(new BinaryResponseParser());
+    this.updatesToLeaders = true;
+    shutdownLBHttpSolrServer = true;
+  }
+  
+  /**
    * @param zkHost
    *          A zookeeper client endpoint.
    * @param updatesToLeaders
@@ -265,6 +317,13 @@ public class CloudSolrServer extends Sol
     lbServer.setRequestWriter(requestWriter);
   }
 
+  /**
+   * @return the zkHost value used to connect to zookeeper.
+   */
+  public String getZkHost() {
+    return zkHost;
+  }
+
   public ZkStateReader getZkStateReader() {
     return zkStateReader;
   }
@@ -349,7 +408,7 @@ public class CloudSolrServer extends Sol
     this.parallelUpdates = parallelUpdates;
   }
 
-  private NamedList directUpdate(AbstractUpdateRequest request, ClusterState clusterState) throws SolrServerException {
+  private NamedList<Object> directUpdate(AbstractUpdateRequest request, ClusterState clusterState) throws SolrServerException {
     UpdateRequest updateRequest = (UpdateRequest) request;
     ModifiableSolrParams params = (ModifiableSolrParams) request.getParams();
     ModifiableSolrParams routableParams = new ModifiableSolrParams();
@@ -396,8 +455,8 @@ public class CloudSolrServer extends Sol
       return null;
     }
 
-    NamedList<Throwable> exceptions = new NamedList<Throwable>();
-    NamedList<NamedList> shardResponses = new NamedList<NamedList>();
+    NamedList<Throwable> exceptions = new NamedList<>();
+    NamedList<NamedList> shardResponses = new NamedList<>();
 
     Map<String, LBHttpSolrServer.Req> routes = updateRequest.getRoutes(router, col, urlMap, routableParams, this.idField);
     if (routes == null) {
@@ -440,7 +499,7 @@ public class CloudSolrServer extends Sol
         String url = entry.getKey();
         LBHttpSolrServer.Req lbRequest = entry.getValue();
         try {
-          NamedList rsp = lbServer.request(lbRequest).getResponse();
+          NamedList<Object> rsp = lbServer.request(lbRequest).getResponse();
           shardResponses.add(url, rsp);
         } catch (Exception e) {
           throw new SolrServerException(e);
@@ -752,7 +811,7 @@ public class CloudSolrServer extends Sol
     
     if (request instanceof IsUpdateRequest) {
       if (request instanceof UpdateRequest) {
-        NamedList response = directUpdate((AbstractUpdateRequest) request,
+        NamedList<Object> response = directUpdate((AbstractUpdateRequest) request,
             clusterState);
         if (response != null) {
           return response;

Modified: lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java (original)
+++ lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/client/solrj/impl/HttpSolrServer.java Wed Oct 15 01:26:26 2014
@@ -330,12 +330,11 @@ public class HttpSolrServer extends Solr
             boolean isMultipart = ((this.useMultiPartPost && SolrRequest.METHOD.POST == request.getMethod())
               || ( streams != null && streams.size() > 1 )) && !hasNullStreamName;
 
-            // send server list and request list as query string params
-            ModifiableSolrParams queryParams = calculateQueryParams(this.queryParams, wparams);
-            queryParams.add(calculateQueryParams(request.getQueryParams(), wparams));
-
             LinkedList<NameValuePair> postOrPutParams = new LinkedList<>();
             if (streams == null || isMultipart) {
+              // send server list and request list as query string params
+              ModifiableSolrParams queryParams = calculateQueryParams(this.queryParams, wparams);
+              queryParams.add(calculateQueryParams(request.getQueryParams(), wparams));
               String fullQueryUrl = url + ClientUtils.toQueryString( queryParams, false );
               HttpEntityEnclosingRequestBase postOrPut = SolrRequest.METHOD.POST == request.getMethod() ?
                 new HttpPost(fullQueryUrl) : new HttpPut(fullQueryUrl);

Modified: lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java (original)
+++ lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/client/solrj/impl/LBHttpSolrServer.java Wed Oct 15 01:26:26 2014
@@ -286,7 +286,7 @@ public class LBHttpSolrServer extends So
     Rsp rsp = new Rsp();
     Exception ex = null;
     boolean isUpdate = req.request instanceof IsUpdateRequest;
-    List<ServerWrapper> skipped = new ArrayList<>(req.getNumDeadServersToTry());
+    List<ServerWrapper> skipped = null;
 
     for (String serverStr : req.getServers()) {
       serverStr = normalize(serverStr);
@@ -294,8 +294,16 @@ public class LBHttpSolrServer extends So
       ServerWrapper wrapper = zombieServers.get(serverStr);
       if (wrapper != null) {
         // System.out.println("ZOMBIE SERVER QUERIED: " + serverStr);
-        if (skipped.size() < req.getNumDeadServersToTry())
-          skipped.add(wrapper);
+        final int numDeadServersToTry = req.getNumDeadServersToTry();
+        if (numDeadServersToTry > 0) {
+          if (skipped == null) {
+            skipped = new ArrayList<>(numDeadServersToTry);
+            skipped.add(wrapper);
+          }
+          else if (skipped.size() < numDeadServersToTry) {
+            skipped.add(wrapper);
+          }
+        }
         continue;
       }
       rsp.server = serverStr;
@@ -308,10 +316,12 @@ public class LBHttpSolrServer extends So
     }
 
     // try the servers we previously skipped
-    for (ServerWrapper wrapper : skipped) {
-      ex = doRequest(wrapper.solrServer, req, rsp, isUpdate, true, wrapper.getKey());
-      if (ex == null) {
-         return rsp; // SUCCESS
+    if (skipped != null) {
+      for (ServerWrapper wrapper : skipped) {
+        ex = doRequest(wrapper.solrServer, req, rsp, isUpdate, true, wrapper.getKey());
+        if (ex == null) {
+          return rsp; // SUCCESS
+        }
       }
     }
 

Modified: lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/common/params/CollectionParams.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/common/params/CollectionParams.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/common/params/CollectionParams.java (original)
+++ lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/common/params/CollectionParams.java Wed Oct 15 01:26:26 2014
@@ -48,7 +48,8 @@ public interface CollectionParams 
     LIST,
     CLUSTERSTATUS,
     ADDREPLICAPROP,
-    DELETEREPLICAPROP;
+    DELETEREPLICAPROP,
+    BALANCESLICEUNIQUE;
     
     public static CollectionAction get( String p )
     {

Modified: lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java (original)
+++ lucene/dev/branches/lucene5969/solr/solrj/src/java/org/apache/solr/common/util/JsonRecordReader.java Wed Oct 15 01:26:26 2014
@@ -29,6 +29,7 @@ import static org.noggit.JSONParser.*;
  */
 
 public class JsonRecordReader {
+  public static final String DELIM = ".";
 
   private Node rootNode = new Node("/", (Node)null);
 
@@ -159,6 +160,7 @@ public class JsonRecordReader {
     boolean isRecord = false; //flag: this Node starts a new record
     Node wildCardChild ;
     Node recursiveWildCardChild;
+    private boolean useFqn = false;
 
 
     public Node(String name, Node p) {
@@ -233,6 +235,10 @@ public class JsonRecordReader {
           // path with content we want to store and return
           n.isLeaf = true;        // we have to store text found here
           n.fieldName = fieldName; // name to store collected text against
+          if("$FQN".equals(n.fieldName)) {
+            n.fieldName = null;
+            n.useFqn = true;
+          }
         }
       } else {
         //wildcards must only come at the end
@@ -278,13 +284,13 @@ public class JsonRecordReader {
         event = parser.nextEvent();
         if(event == EOF) break;
         if (event == OBJECT_START) {
-          handleObjectStart(parser, new HashSet<Node>(), handler, values, stack, recordStarted);
+          handleObjectStart(parser, new HashSet<Node>(), handler, values, stack, recordStarted, null);
         } else if (event == ARRAY_START) {
           for (; ; ) {
             event = parser.nextEvent();
             if (event == ARRAY_END) break;
             if (event == OBJECT_START) {
-              handleObjectStart(parser, new HashSet<Node>(), handler, values, stack, recordStarted);
+              handleObjectStart(parser, new HashSet<Node>(), handler, values, stack, recordStarted,null);
             }
           }
         }
@@ -306,7 +312,8 @@ public class JsonRecordReader {
      */
     private void handleObjectStart(final JSONParser parser, final Set<Node> childrenFound,
                                    final Handler handler, final Map<String, Object> values,
-                                   final Stack<Set<String>> stack, boolean recordStarted)
+                                   final Stack<Set<String>> stack, boolean recordStarted,
+                                   MethodFrameWrapper frameWrapper)
         throws IOException {
 
       final boolean isRecordStarted = recordStarted || isRecord;
@@ -324,20 +331,22 @@ public class JsonRecordReader {
       }
 
       class Wrapper extends MethodFrameWrapper {
-        Wrapper( Node node) {
+        Wrapper(Node node, MethodFrameWrapper parent, String name) {
           this.node = node;
+          this.parent= parent;
+          this.name = name;
         }
 
         @Override
         public void walk(int event) throws IOException {
           if (event == OBJECT_START) {
-            node.handleObjectStart(parser, childrenFound, handler, values, stack, isRecordStarted);
+            node.handleObjectStart(parser, childrenFound, handler, values, stack, isRecordStarted, this);
           } else if (event == ARRAY_START) {
             for (; ; ) {
               event = parser.nextEvent();
               if (event == ARRAY_END) break;
               if (event == OBJECT_START) {
-                node.handleObjectStart(parser, childrenFound, handler, values, stack, isRecordStarted);
+                node.handleObjectStart(parser, childrenFound, handler, values, stack, isRecordStarted,this);
               }
             }
           }
@@ -365,10 +374,10 @@ public class JsonRecordReader {
           if (node != null) {
             if (node.isLeaf) {//this is a leaf collect data here
               event = parser.nextEvent();
-              String nameInRecord = node.fieldName == null ? name : node.fieldName;
+              String nameInRecord = node.fieldName == null ? getNameInRecord(name, frameWrapper, node) : node.fieldName;
               MethodFrameWrapper runnable = null;
               if(event == OBJECT_START || event == ARRAY_START){
-                if(node.recursiveWildCardChild !=null) runnable = new Wrapper(node);
+                if(node.recursiveWildCardChild !=null) runnable = new Wrapper(node, frameWrapper,name);
               }
               Object val = parseSingleFieldValue(event, parser, runnable);
               if(val !=null) {
@@ -378,7 +387,7 @@ public class JsonRecordReader {
 
             } else {
               event = parser.nextEvent();
-              new Wrapper(node).walk(event);
+              new Wrapper(node, frameWrapper, name).walk(event);
             }
           } else {
             //this is not something we are interested in  . skip it
@@ -413,6 +422,13 @@ public class JsonRecordReader {
       }
     }
 
+    private String getNameInRecord(String name,MethodFrameWrapper frameWrapper, Node n) {
+      if(frameWrapper == null || !n.useFqn) return name;
+      StringBuilder sb = new StringBuilder();
+      frameWrapper.prependName(sb);
+      return sb.append(DELIM).append(name).toString();
+    }
+
     private boolean isRecord() {
       return isRecord;
     }
@@ -521,6 +537,16 @@ public class JsonRecordReader {
   }
   static abstract class MethodFrameWrapper {
     Node node;
+    MethodFrameWrapper parent;
+    String name;
+
+    void prependName(StringBuilder sb){
+      if(parent !=null) {
+        parent.prependName(sb);
+        sb.append(DELIM);
+      }
+      sb.append(name);
+    }
 
     public abstract void walk(int event) throws IOException;
   }

Modified: lucene/dev/branches/lucene5969/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java (original)
+++ lucene/dev/branches/lucene5969/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java Wed Oct 15 01:26:26 2014
@@ -640,5 +640,21 @@ public class BasicHttpSolrServerTest ext
       server.request(req);
     } catch (Throwable t) {}
     verifyServletState(server, req);
+
+    // test with both request and server query params with single stream
+    DebugServlet.clear();
+    req = new UpdateRequest();
+    req.add(new SolrInputDocument());
+    server.setQueryParams(setOf("serverOnly", "both"));
+    req.setQueryParams(setOf("requestOnly", "both"));
+    setReqParamsOf(req, "serverOnly", "requestOnly", "both", "neither");
+     try {
+      server.request(req);
+    } catch (Throwable t) {}
+    // NOTE: single stream requests send all the params
+    // as part of the query string.  So add "neither" to the request
+    // so it passes the verification step.
+    req.setQueryParams(setOf("requestOnly", "both", "neither"));
+    verifyServletState(server, req);
   }
 }

Modified: lucene/dev/branches/lucene5969/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrServerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrServerTest.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrServerTest.java (original)
+++ lucene/dev/branches/lucene5969/solr/solrj/src/test/org/apache/solr/client/solrj/impl/CloudSolrServerTest.java Wed Oct 15 01:26:26 2014
@@ -158,7 +158,7 @@ public class CloudSolrServerTest extends
     request.setAction(AbstractUpdateRequest.ACTION.COMMIT, false, false);
     
     // Test single threaded routed updates for UpdateRequest
-    NamedList response = cloudClient.request(request);
+    NamedList<Object> response = cloudClient.request(request);
     CloudSolrServer.RouteResponse rr = (CloudSolrServer.RouteResponse) response;
     Map<String,LBHttpSolrServer.Req> routes = rr.getRoutes();
     Iterator<Map.Entry<String,LBHttpSolrServer.Req>> it = routes.entrySet()
@@ -330,11 +330,8 @@ public class CloudSolrServerTest extends
     // use generic request to avoid extra processing of queries
     QueryRequest req = new QueryRequest(params);
     NamedList<Object> resp = server.request(req);
-    NamedList mbeans = (NamedList) resp.get("solr-mbeans");
-    NamedList queryHandler = (NamedList) mbeans.get("QUERYHANDLER");
-    NamedList select = (NamedList) queryHandler.get("org.apache.solr.handler.StandardRequestHandler");
-    NamedList stats = (NamedList) select.get("stats");
-    return (Long) stats.get("requests");
+    return (Long) resp.findRecursive("solr-mbeans", "QUERYHANDLER",
+        "org.apache.solr.handler.StandardRequestHandler", "stats", "requests");
   }
   
   @Override

Modified: lucene/dev/branches/lucene5969/solr/solrj/src/test/org/apache/solr/common/util/TestJsonRecordReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene5969/solr/solrj/src/test/org/apache/solr/common/util/TestJsonRecordReader.java?rev=1631928&r1=1631927&r2=1631928&view=diff
==============================================================================
--- lucene/dev/branches/lucene5969/solr/solrj/src/test/org/apache/solr/common/util/TestJsonRecordReader.java (original)
+++ lucene/dev/branches/lucene5969/solr/solrj/src/test/org/apache/solr/common/util/TestJsonRecordReader.java Wed Oct 15 01:26:26 2014
@@ -181,7 +181,21 @@ public class TestJsonRecordReader  exten
     assertEquals(2, records.size());
     for (Map<String, Object> record : records) {
       assertEquals(6,record.size());
+      assertTrue(record.containsKey("subject"));
+      assertTrue(record.containsKey("test"));
+      assertTrue(record.containsKey("marks"));
     }
+
+    streamer = JsonRecordReader.getInst("/exams", Collections.singletonList("$FQN:/**"));
+    records = streamer.getAllRecords(new StringReader(json));
+    assertEquals(2, records.size());
+    for (Map<String, Object> record : records) {
+      assertEquals(6,record.size());
+      assertTrue(record.containsKey("exams.subject"));
+      assertTrue(record.containsKey("exams.test"));
+      assertTrue(record.containsKey("exams.marks"));
+    }
+
     streamer = JsonRecordReader.getInst("/", Collections.singletonList("txt:/**"));
     records = streamer.getAllRecords(new StringReader(json));
     assertEquals(1, records.size());



Mime
View raw message