You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by mi...@apache.org on 2015/01/04 15:53:21 UTC

svn commit: r1649347 [18/31] - in /lucene/dev/branches/lucene6005: ./ dev-tools/ dev-tools/idea/solr/contrib/dataimporthandler-extras/ dev-tools/idea/solr/contrib/extraction/ dev-tools/idea/solr/contrib/map-reduce/ dev-tools/idea/solr/contrib/velocity/...

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/UpdateLog.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/UpdateLog.java?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/UpdateLog.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/UpdateLog.java Sun Jan  4 14:53:12 2015
@@ -317,7 +317,7 @@ public class UpdateLog implements Plugin
   }
 
   /* Takes over ownership of the log, keeping it until no longer needed
-     and then decrementing it's reference and dropping it.
+     and then decrementing its reference and dropping it.
    */
   protected synchronized void addOldLog(TransactionLog oldLog, boolean removeOld) {
     if (oldLog == null) return;

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/processor/AllValuesOrNoneFieldMutatingUpdateProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/processor/AllValuesOrNoneFieldMutatingUpdateProcessor.java?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/processor/AllValuesOrNoneFieldMutatingUpdateProcessor.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/processor/AllValuesOrNoneFieldMutatingUpdateProcessor.java Sun Jan  4 14:53:12 2015
@@ -22,6 +22,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
                    
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 import java.util.Locale;
 
@@ -75,9 +76,11 @@ public abstract class AllValuesOrNoneFie
   protected abstract Object mutateValue(final Object srcVal);
 
   protected final SolrInputField mutate(final SolrInputField srcField) {
+    Collection<Object> vals = srcField.getValues();
+    if(vals== null || vals.isEmpty()) return srcField;
     List<String> messages = null;
     SolrInputField result = new SolrInputField(srcField.getName());
-    for (final Object srcVal : srcField.getValues()) {
+    for (final Object srcVal : vals) {
       final Object destVal = mutateValue(srcVal);
       if (SKIP_FIELD_VALUE_LIST_SINGLETON == destVal) {
         log.debug("field '{}' {} value '{}' is not mutatable, so no values will be mutated",

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/processor/DistributedUpdateProcessor.java Sun Jan  4 14:53:12 2015
@@ -372,7 +372,7 @@ public class DistributedUpdateProcessor
         doDefensiveChecks(phase);
 
         // if request is coming from another collection then we want it to be sent to all replicas
-        // even if it's phase is FROMLEADER
+        // even if its phase is FROMLEADER
         String fromCollection = updateCommand.getReq().getParams().get(DISTRIB_FROM_COLLECTION);
 
         if (DistribPhase.FROMLEADER == phase && !isSubShardLeader && fromCollection == null) {
@@ -774,7 +774,7 @@ public class DistributedUpdateProcessor
     List<Error> errors = cmdDistrib.getErrors();
     // TODO - we may need to tell about more than one error...
     
-    // if its a forward, any fail is a problem - 
+    // if it's a forward, any fail is a problem - 
     // otherwise we assume things are fine if we got it locally
     // until we start allowing min replication param
     if (errors.size() > 0) {

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/processor/FieldValueMutatingUpdateProcessor.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/processor/FieldValueMutatingUpdateProcessor.java?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/processor/FieldValueMutatingUpdateProcessor.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/update/processor/FieldValueMutatingUpdateProcessor.java Sun Jan  4 14:53:12 2015
@@ -17,6 +17,8 @@
 
 package org.apache.solr.update.processor;
 
+import java.util.Collection;
+
 import org.apache.solr.common.SolrInputField;
 
 import org.slf4j.Logger;
@@ -61,8 +63,10 @@ public abstract class FieldValueMutating
   
   @Override
   protected final SolrInputField mutate(final SolrInputField src) {
+    Collection<Object> values = src.getValues();
+    if(values == null) return src;//don't mutate
     SolrInputField result = new SolrInputField(src.getName());
-    for (final Object srcVal : src.getValues()) {
+    for (final Object srcVal : values) {
       final Object destVal = mutateValue(srcVal);
       if (DELETE_VALUE_SINGLETON == destVal) { 
         /* NOOP */

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/ConcurrentLRUCache.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/ConcurrentLRUCache.java?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/ConcurrentLRUCache.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/ConcurrentLRUCache.java Sun Jan  4 14:53:12 2015
@@ -245,7 +245,7 @@ public class ConcurrentLRUCache<K,V> {
             // this entry is guaranteed not to be in the bottom
             // group, so do nothing but remove it from the eset.
             numKept++;
-            // remove the entry by moving the last element to it's position
+            // remove the entry by moving the last element to its position
             eset[i] = eset[eSize-1];
             eSize--;
 
@@ -258,7 +258,7 @@ public class ConcurrentLRUCache<K,V> {
             evictEntry(ce.key);
             numRemoved++;
 
-            // remove the entry by moving the last element to it's position
+            // remove the entry by moving the last element to its position
             eset[i] = eset[eSize-1];
             eSize--;
           } else {

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/SimplePostTool.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/SimplePostTool.java?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/SimplePostTool.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/SimplePostTool.java Sun Jan  4 14:53:12 2015
@@ -17,6 +17,19 @@ package org.apache.solr.util;
  * limitations under the License.
  */
 
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+import javax.xml.bind.DatatypeConverter;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
 import java.io.BufferedReader;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
@@ -32,6 +45,8 @@ import java.net.MalformedURLException;
 import java.net.ProtocolException;
 import java.net.URL;
 import java.net.URLEncoder;
+import java.nio.BufferOverflowException;
+import java.nio.ByteBuffer;
 import java.nio.charset.Charset;
 import java.nio.charset.StandardCharsets;
 import java.text.SimpleDateFormat;
@@ -51,20 +66,6 @@ import java.util.zip.GZIPInputStream;
 import java.util.zip.Inflater;
 import java.util.zip.InflaterInputStream;
 
-import javax.xml.bind.DatatypeConverter;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpression;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
 /**
  * A simple utility class for posting raw updates to a Solr server, 
  * has a main method so it can be run on the command line.
@@ -75,7 +76,6 @@ import org.xml.sax.SAXException;
 public class SimplePostTool {
   private static final String DEFAULT_POST_HOST = "localhost";
   private static final String DEFAULT_POST_PORT = "8983";
-  private static final String DEFAULT_POST_CORE = "collection1";
   private static final String VERSION_OF_THIS_TOOL = "1.5";
 
   private static final String DEFAULT_COMMIT = "yes";
@@ -215,13 +215,22 @@ public class SimplePostTool {
       if (! DATA_MODES.contains(mode)) {
         fatal("System Property 'data' is not valid for this tool: " + mode);
       }
+      
       String params = System.getProperty("params", "");
 
       String host = System.getProperty("host", DEFAULT_POST_HOST);
       String port = System.getProperty("port", DEFAULT_POST_PORT);
-      String core = System.getProperty("c", DEFAULT_POST_CORE);
-
-      urlStr = System.getProperty("url", String.format(Locale.ROOT, "http://%s:%s/solr/%s/update", host, port, core));
+      String core = System.getProperty("c");
+      
+      urlStr = System.getProperty("url");
+      
+      if (urlStr == null && core == null) {
+        fatal("Specifying either url or core/collection is mandatory.\n" + USAGE_STRING_SHORT);
+      }
+      
+      if(urlStr == null) {
+        urlStr = String.format(Locale.ROOT, "http://%s:%s/solr/%s/update", host, port, core);
+      }
       urlStr = SimplePostTool.appendParam(urlStr, params);
       URL url = new URL(urlStr);
       boolean auto = isOn(System.getProperty("auto", DEFAULT_AUTO));
@@ -370,12 +379,12 @@ public class SimplePostTool {
     System.out.println
     (USAGE_STRING_SHORT+"\n\n" +
      "Supported System Properties and their defaults:\n"+
+     "  -Dc=<core/collection>\n"+
+     "  -Durl=<solr-update-url> \n"+
      "  -Ddata=files|web|args|stdin (default=" + DEFAULT_DATA_MODE + ")\n"+
      "  -Dtype=<content-type> (default=" + DEFAULT_CONTENT_TYPE + ")\n"+
-     "  -Durl=<solr-update-url> (default=" + String.format(Locale.ROOT, "http://%s:%s/solr/%s/update", DEFAULT_POST_HOST, DEFAULT_POST_PORT, DEFAULT_POST_CORE) + ")\n"+
      "  -Dhost=<host> (default: " + DEFAULT_POST_HOST+ ")\n"+
      "  -Dport=<port> (default: " + DEFAULT_POST_PORT+ ")\n"+
-     "  -Dc=<core/collection> (default: " + DEFAULT_POST_CORE+ ")\n"+
      "  -Dauto=yes|no (default=" + DEFAULT_AUTO + ")\n"+
      "  -Drecursive=yes|no|<depth> (default=" + DEFAULT_RECURSIVE + ")\n"+
      "  -Ddelay=<seconds> (default=0 for files, 10 for web)\n"+
@@ -384,26 +393,27 @@ public class SimplePostTool {
      "  -Dcommit=yes|no (default=" + DEFAULT_COMMIT + ")\n"+
      "  -Doptimize=yes|no (default=" + DEFAULT_OPTIMIZE + ")\n"+
      "  -Dout=yes|no (default=" + DEFAULT_OUT + ")\n\n"+
-     "This is a simple command line tool for POSTing raw data to a Solr\n"+
-     "port.  Data can be read from files specified as commandline args,\n"+
+     "This is a simple command line tool for POSTing raw data to a Solr port.\n"+
+     "NOTE: Specifying the url/core/collection name is mandatory.\n" +
+     "Data can be read from files specified as commandline args,\n"+
      "URLs specified as args, as raw commandline arg strings or via STDIN.\n"+
      "Examples:\n"+
      "  java -jar post.jar *.xml\n"+
-     "  java -Ddata=args  -jar post.jar '<delete><id>42</id></delete>'\n"+
-     "  java -Ddata=stdin -jar post.jar < hd.xml\n"+
-     "  java -Ddata=web -jar post.jar http://example.com/\n"+
-     "  java -Dtype=text/csv -jar post.jar *.csv\n"+
-     "  java -Dtype=application/json -jar post.jar *.json\n"+
+     "  java -Ddata=args -Dc=gettingstarted -jar post.jar '<delete><id>42</id></delete>'\n"+
+     "  java -Ddata=stdin -Dc=gettingstarted -jar post.jar < hd.xml\n"+
+     "  java -Ddata=web -Dc=gettingstarted -jar post.jar http://example.com/\n"+
+     "  java -Dtype=text/csv -Dc=gettingstarted -jar post.jar *.csv\n"+
+     "  java -Dtype=application/json -Dc=gettingstarted -jar post.jar *.json\n"+
      "  java -Durl=http://localhost:8983/solr/update/extract -Dparams=literal.id=a -Dtype=application/pdf -jar post.jar a.pdf\n"+
-     "  java -Dauto -jar post.jar *\n"+
-     "  java -Dauto -Drecursive -jar post.jar afolder\n"+
-     "  java -Dauto -Dfiletypes=ppt,html -jar post.jar afolder\n"+
+     "  java -Dauto -Dc=gettingstarted -jar post.jar *\n"+
+     "  java -Dauto -Dc=gettingstarted -Drecursive -jar post.jar afolder\n"+
+     "  java -Dauto -Dc=gettingstarted -Dfiletypes=ppt,html -jar post.jar afolder\n"+
      "The options controlled by System Properties include the Solr\n"+
      "URL to POST to, the Content-Type of the data, whether a commit\n"+
      "or optimize should be executed, and whether the response should\n"+
      "be written to STDOUT. If auto=yes the tool will try to set type\n"+
-     "and url automatically from file name. When posting rich documents\n"+
-     "the file name will be propagated as \"resource.name\" and also used\n"+
+     "automatically from file name. When posting rich documents the\n"+
+     "file name will be propagated as \"resource.name\" and also used\n"+
      "as \"literal.id\". You may override these or any other request parameter\n"+
      "through the -Dparams property. To do a commit only, use \"-\" as argument.\n"+
      "The web mode is a simple crawler following links within domain, default delay=10s.");
@@ -581,14 +591,14 @@ public class SimplePostTool {
           URL postUrl = new URL(appendParam(solrUrl.toString(), 
               "literal.id="+URLEncoder.encode(u.toString(),"UTF-8") +
               "&literal.url="+URLEncoder.encode(u.toString(),"UTF-8")));
-          boolean success = postData(new ByteArrayInputStream(result.content), null, out, result.contentType, postUrl);
+          boolean success = postData(new ByteArrayInputStream(result.content.array(), result.content.arrayOffset(),result.content.limit() ), null, out, result.contentType, postUrl);
           if (success) {
             info("POSTed web resource "+u+" (depth: "+level+")");
             Thread.sleep(delay * 1000);
             numPages++;
             // Pull links from HTML pages only
             if(recursive > level && result.contentType.equals("text/html")) {
-              Set<URL> children = pageFetcher.getLinksFromWebPage(u, new ByteArrayInputStream(result.content), result.contentType, postUrl);
+              Set<URL> children = pageFetcher.getLinksFromWebPage(u, new ByteArrayInputStream(result.content.array(), result.content.arrayOffset(), result.content.limit()), result.contentType, postUrl);
               subStack.addAll(children);
             }
           } else {
@@ -609,23 +619,35 @@ public class SimplePostTool {
     }
     return numPages;    
   }
+  public static class BAOS extends ByteArrayOutputStream {
+    public ByteBuffer getByteBuffer() {
+      return ByteBuffer.wrap(super.buf,0,super.count);
+    }
+  }
+  public static ByteBuffer inputStreamToByteArray(InputStream is) throws IOException {
+    return inputStreamToByteArray(is,Integer.MAX_VALUE);
+
+  }
 
   /**
    * Reads an input stream into a byte array
+   *
    * @param is the input stream
    * @return the byte array
    * @throws IOException If there is a low-level I/O error.
    */
-  protected byte[] inputStreamToByteArray(InputStream is) throws IOException {
-    ByteArrayOutputStream bos = new ByteArrayOutputStream();
+  public static ByteBuffer inputStreamToByteArray(InputStream is, long maxSize) throws IOException {
+    BAOS bos =  new BAOS();
+    long sz = 0;
     int next = is.read();
     while (next > -1) {
-        bos.write(next);
-        next = is.read();
+      if(++sz > maxSize) throw new BufferOverflowException();
+      bos.write(next);
+      next = is.read();
     }
     bos.flush();
     is.close();
-    return bos.toByteArray();
+    return bos.getByteBuffer();
   }
 
   /**
@@ -740,7 +762,7 @@ public class SimplePostTool {
   }
 
   /**
-   * Opens the file and posts it's contents to the solrUrl,
+   * Opens the file and posts its contents to the solrUrl,
    * writes to response to output. 
    */
   public void postFile(File file, OutputStream output, String type) {
@@ -1198,6 +1220,6 @@ public class SimplePostTool {
     int httpStatus = 200;
     String contentType = "text/html";
     URL redirectUrl = null;
-    byte[] content;
+    ByteBuffer content;
   }
 }

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/SolrCLI.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/SolrCLI.java?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/SolrCLI.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/SolrCLI.java Sun Jan  4 14:53:12 2015
@@ -17,25 +17,6 @@ package org.apache.solr.util;
  * limitations under the License.
  */
 
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.PrintStream;
-import java.net.ConnectException;
-import java.net.SocketException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Enumeration;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
 import org.apache.commons.cli.CommandLine;
 import org.apache.commons.cli.GnuParser;
 import org.apache.commons.cli.HelpFormatter;
@@ -61,9 +42,9 @@ import org.apache.log4j.LogManager;
 import org.apache.log4j.Logger;
 import org.apache.solr.client.solrj.SolrQuery;
 import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.impl.CloudSolrServer;
+import org.apache.solr.client.solrj.impl.CloudSolrClient;
 import org.apache.solr.client.solrj.impl.HttpClientUtil;
-import org.apache.solr.client.solrj.impl.HttpSolrServer;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
 import org.apache.solr.client.solrj.response.QueryResponse;
 import org.apache.solr.cloud.ZkController;
 import org.apache.solr.common.SolrException;
@@ -78,6 +59,25 @@ import org.noggit.JSONParser;
 import org.noggit.JSONWriter;
 import org.noggit.ObjectBuilder;
 
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.net.ConnectException;
+import java.net.SocketException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Set;
+import java.util.TreeSet;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
 /**
  * Command-line utility for working with Solr.
  */
@@ -93,7 +93,7 @@ public class SolrCLI {
   }
   
   /**
-   * Helps build SolrCloud aware tools by initializing a CloudSolrServer
+   * Helps build SolrCloud aware tools by initializing a CloudSolrClient
    * instance before running the tool.
    */
   public static abstract class SolrCloudTool implements Tool {
@@ -111,31 +111,41 @@ public class SolrCLI {
       String zkHost = cli.getOptionValue("zkHost", ZK_HOST);
       
       log.debug("Connecting to Solr cluster: " + zkHost);
-      CloudSolrServer cloudSolrServer = null;
+      int exitStatus = 0;
+      CloudSolrClient cloudSolrClient = null;
       try {
-        cloudSolrServer = new CloudSolrServer(zkHost);
+        cloudSolrClient = new CloudSolrClient(zkHost);
         
         String collection = cli.getOptionValue("collection");
         if (collection != null)
-          cloudSolrServer.setDefaultCollection(collection);
+          cloudSolrClient.setDefaultCollection(collection);
         
-        cloudSolrServer.connect();        
-        runCloudTool(cloudSolrServer, cli);
+        cloudSolrClient.connect();
+        exitStatus = runCloudTool(cloudSolrClient, cli);
+      } catch (Exception exc) {
+        // since this is a CLI, spare the user the stacktrace
+        String excMsg = exc.getMessage();
+        if (excMsg != null) {
+          System.err.println("\nERROR:"+excMsg+"\n");
+          exitStatus = 1;
+        } else {
+          throw exc;
+        }
       } finally {
-        if (cloudSolrServer != null) {
+        if (cloudSolrClient != null) {
           try {
-            cloudSolrServer.shutdown();
+            cloudSolrClient.shutdown();
           } catch (Exception ignore) {}
         }
       }
       
-      return 0;
+      return exitStatus;
     }
     
     /**
      * Runs a SolrCloud tool with CloudSolrServer initialized
      */
-    protected abstract void runCloudTool(CloudSolrServer cloudSolrServer, CommandLine cli) 
+    protected abstract int runCloudTool(CloudSolrClient cloudSolrClient, CommandLine cli)
         throws Exception;
   }
   
@@ -182,9 +192,7 @@ public class SolrCLI {
         processCommandLineArgs(joinCommonAndToolOptions(tool.getOptions()), toolArgs);
 
     // run the tool
-    int exitCode = tool.runTool(cli);
-    
-    System.exit(exitCode);    
+    System.exit(tool.runTool(cli));
   }
   
   /**
@@ -327,9 +335,8 @@ public class SolrCLI {
       
       for (String classInPackage : classes) {
         Class<?> theClass = Class.forName(classInPackage);
-        if (Tool.class.isAssignableFrom(theClass)) {
+        if (Tool.class.isAssignableFrom(theClass))
           toolClasses.add((Class<Tool>) theClass);
-        }
       }
     } catch (Exception e) {
       // safe to squelch this as it's just looking for tools to run
@@ -350,9 +357,8 @@ public class SolrCLI {
         if (entry.getName().endsWith(".class")) {
           String className = entry.getName().replaceAll("[$].*", "")
               .replaceAll("[.]class", "").replace('/', '.');
-          if (className.startsWith(packageName)) {
+          if (className.startsWith(packageName))
             classes.add(className);
-          }
         }
       }
     }
@@ -367,9 +373,9 @@ public class SolrCLI {
     Throwable rootCause = SolrException.getRootCause(exc);
     boolean wasCommError =
         (rootCause instanceof ConnectException ||
-            rootCause instanceof ConnectTimeoutException ||
-            rootCause instanceof NoHttpResponseException ||
-            rootCause instanceof SocketException);
+         rootCause instanceof ConnectTimeoutException ||
+         rootCause instanceof NoHttpResponseException ||
+         rootCause instanceof SocketException);
     return wasCommError;
   }
   
@@ -470,7 +476,7 @@ public class SolrCLI {
       String errMsg = asString("/error/msg", json);
       if (errMsg == null)
         errMsg = String.valueOf(json);
-      throw new SolrServerException("Request to "+getUrl+" failed due to: "+errMsg);
+      throw new SolrServerException(errMsg);
     }
     return json;
   }  
@@ -623,7 +629,9 @@ public class SolrCLI {
         throws Exception
     {
       Map<String,Object> status = new LinkedHashMap<String,Object>();
-      
+
+      String solrHome = (String)info.get("solr_home");
+      status.put("solr_home", solrHome != null ? solrHome : "?");
       status.put("version", asString("/lucene/solr-impl-version", info));      
       status.put("startTime", asString("/jvm/jmx/startTime", info));
       status.put("uptime", uptime(asLong("/jvm/jmx/upTimeMS", info)));
@@ -706,198 +714,6 @@ public class SolrCLI {
 
   private static final String DEFAULT_CONFIG_SET = "data_driven_schema_configs";
 
-  /**
-   * Supports create_collection command in the bin/solr script.
-   */
-  public static class CreateCollectionTool implements Tool {
-
-    @Override
-    public String getName() {
-      return "create_collection";
-    }
-
-    @SuppressWarnings("static-access")
-    @Override
-    public Option[] getOptions() {
-      return new Option[] {
-          OptionBuilder
-              .withArgName("HOST")
-              .hasArg()
-              .isRequired(false)
-              .withDescription("Address of the Zookeeper ensemble; defaults to: "+ZK_HOST)
-              .create("zkHost"),
-          OptionBuilder
-              .withArgName("HOST")
-              .hasArg()
-              .isRequired(false)
-              .withDescription("Base Solr URL, which can be used to determine the zkHost if that's not known")
-              .create("solrUrl"),
-          OptionBuilder
-              .withArgName("NAME")
-              .hasArg()
-              .isRequired(true)
-              .withDescription("Name of collection to create.")
-              .create("name"),
-          OptionBuilder
-              .withArgName("#")
-              .hasArg()
-              .isRequired(false)
-              .withDescription("Number of shards; default is 1")
-              .create("shards"),
-          OptionBuilder
-              .withArgName("#")
-              .hasArg()
-              .isRequired(false)
-              .withDescription("Number of copies of each document across the collection (replicas per shard); default is 1")
-              .create("replicationFactor"),
-          OptionBuilder
-              .withArgName("#")
-              .hasArg()
-              .isRequired(false)
-              .withDescription("Maximum number of shards per Solr node; default is determined based on the number of shards, replication factor, and live nodes.")
-              .create("maxShardsPerNode"),
-          OptionBuilder
-              .withArgName("NAME")
-              .hasArg()
-              .isRequired(false)
-              .withDescription("Name of the configuration for this collection; default is "+DEFAULT_CONFIG_SET)
-              .create("config"),
-          OptionBuilder
-              .withArgName("DIR")
-              .hasArg()
-              .isRequired(true)
-              .withDescription("Path to configsets directory on the local system.")
-              .create("configsetsDir")
-      };
-    }
-
-    public int runTool(CommandLine cli) throws Exception {
-
-      // quiet down the ZK logging for cli tools
-      LogManager.getLogger("org.apache.zookeeper").setLevel(Level.ERROR);
-      LogManager.getLogger("org.apache.solr.common.cloud").setLevel(Level.WARN);
-
-      String zkHost = cli.getOptionValue("zkHost");
-      if (zkHost == null) {
-        // find it using the localPort
-        String solrUrl = cli.getOptionValue("solrUrl");
-        if (solrUrl == null)
-          throw new IllegalStateException(
-              "Must provide either the -zkHost or -solrUrl parameters to use the create_collection command!");
-
-        if (!solrUrl.endsWith("/"))
-          solrUrl += "/";
-
-        String systemInfoUrl = solrUrl+"admin/info/system";
-        HttpClient httpClient = getHttpClient();
-        try {
-          // hit Solr to get system info
-          Map<String,Object> systemInfo = getJson(httpClient, systemInfoUrl, 2);
-
-          // convert raw JSON into user-friendly output
-          StatusTool statusTool = new StatusTool();
-          Map<String,Object> status = statusTool.reportStatus(solrUrl, systemInfo, httpClient);
-
-          Map<String,Object> cloud = (Map<String, Object>)status.get("cloud");
-          if (cloud == null) {
-            System.err.println("\nERROR: Solr at "+solrUrl+
-                " is running in standalone server mode, please use the create_core command instead;\n" +
-                "create_collection can only be used when running in SolrCloud mode.\n");
-            return 1;
-          }
-
-          String zookeeper = (String) cloud.get("ZooKeeper");
-          if (zookeeper.endsWith("(embedded)")) {
-            zookeeper = zookeeper.substring(0,zookeeper.length()-"(embedded)".length());
-          }
-          zkHost = zookeeper;
-        } finally {
-          closeHttpClient(httpClient);
-        }
-      }
-
-      CloudSolrServer cloudSolrServer = null;
-      try {
-        cloudSolrServer = new CloudSolrServer(zkHost);
-        System.out.println("Connecting to ZooKeeper at "+zkHost);
-        cloudSolrServer.connect();
-        runCloudTool(cloudSolrServer, cli);
-      } finally {
-        if (cloudSolrServer != null) {
-          try {
-            cloudSolrServer.shutdown();
-          } catch (Exception ignore) {}
-        }
-      }
-
-      return 0;
-    }
-
-    protected void runCloudTool(CloudSolrServer cloudSolrServer, CommandLine cli) throws Exception {
-      Set<String> liveNodes = cloudSolrServer.getZkStateReader().getClusterState().getLiveNodes();
-      if (liveNodes.isEmpty())
-        throw new IllegalStateException("No live nodes found! Cannot create a collection until " +
-            "there is at least 1 live node in the cluster.");
-      String firstLiveNode = liveNodes.iterator().next();
-
-      // build a URL to create the collection
-      int numShards = optionAsInt(cli, "shards", 1);
-      int replicationFactor = optionAsInt(cli, "replicationFactor", 1);
-      int maxShardsPerNode = -1;
-
-      if (cli.hasOption("maxShardsPerNode")) {
-        maxShardsPerNode = Integer.parseInt(cli.getOptionValue("maxShardsPerNode"));
-      } else {
-        // need number of live nodes to determine maxShardsPerNode if it is not set
-        int numNodes = liveNodes.size();
-        maxShardsPerNode = ((numShards*replicationFactor)+numNodes-1)/numNodes;
-      }
-
-      String configSet = cli.getOptionValue("config", DEFAULT_CONFIG_SET);
-      // first, test to see if that config exists in ZK
-      if (!cloudSolrServer.getZkStateReader().getZkClient().exists("/configs/"+configSet, true)) {
-        File configsetsDir = new File(cli.getOptionValue("configsetsDir"));
-        if (!configsetsDir.isDirectory())
-          throw new FileNotFoundException(configsetsDir.getAbsolutePath()+" not found!");
-
-        // upload the configset if it exists
-        File configSetDir = new File(configsetsDir, configSet);
-        if (!configSetDir.isDirectory())
-          throw new FileNotFoundException("Specified config "+configSet+
-              " not found in "+configsetsDir.getAbsolutePath());
-
-        File confDir = new File(configSetDir,"conf");
-        System.out.println("Uploading "+confDir.getAbsolutePath()+
-            " for config "+configSet+" to ZooKeeper at "+cloudSolrServer.getZkHost());
-        ZkController.uploadConfigDir(cloudSolrServer.getZkStateReader().getZkClient(), confDir, configSet);
-      }
-
-      String baseUrl = cloudSolrServer.getZkStateReader().getBaseUrlForNodeName(firstLiveNode);
-      String collectionName = cli.getOptionValue("name");
-      String createCollectionUrl =
-          String.format(Locale.ROOT,
-              "%s/admin/collections?action=CREATE&name=%s&numShards=%d&replicationFactor=%d&maxShardsPerNode=%d&collection.configName=%s",
-              baseUrl,
-              collectionName,
-              numShards,
-              replicationFactor,
-              maxShardsPerNode,
-              configSet);
-
-      System.out.println("Creating new collection '"+collectionName+"' using command:\n\n"+createCollectionUrl+"\n");
-
-      Map<String,Object> json = getJson(createCollectionUrl);
-      CharArr arr = new CharArr();
-      new JSONWriter(arr, 2).write(json);
-      System.out.println(arr.toString());
-      System.out.println();
-    }
-
-    protected int optionAsInt(CommandLine cli, String option, int defaultVal) {
-      return Integer.parseInt(cli.getOptionValue(option, String.valueOf(defaultVal)));
-    }
-  } // end CreateCollectionTool class
-
   private static final long MS_IN_MIN = 60 * 1000L;
   private static final long MS_IN_HOUR = MS_IN_MIN * 60L;
   private static final long MS_IN_DAY = MS_IN_HOUR * 24L;
@@ -1056,7 +872,7 @@ public class SolrCLI {
     }
         
     @Override
-    protected void runCloudTool(CloudSolrServer cloudSolrServer, CommandLine cli) throws Exception {
+    protected int runCloudTool(CloudSolrClient cloudSolrClient, CommandLine cli) throws Exception {
       
       String collection = cli.getOptionValue("collection");
       if (collection == null)
@@ -1064,7 +880,7 @@ public class SolrCLI {
       
       log.info("Running healthcheck for "+collection);
       
-      ZkStateReader zkStateReader = cloudSolrServer.getZkStateReader();
+      ZkStateReader zkStateReader = cloudSolrClient.getZkStateReader();
 
       ClusterState clusterState = zkStateReader.getClusterState();
       Set<String> liveNodes = clusterState.getLiveNodes();
@@ -1074,7 +890,7 @@ public class SolrCLI {
       
       SolrQuery q = new SolrQuery("*:*");
       q.setRows(0);      
-      QueryResponse qr = cloudSolrServer.query(q);
+      QueryResponse qr = cloudSolrClient.query(q);
       String collErr = null;
       long docCount = -1;
       try {
@@ -1108,13 +924,13 @@ public class SolrCLI {
           String coreUrl = replicaCoreProps.getCoreUrl();
           boolean isLeader = coreUrl.equals(leaderUrl);
 
-          // if replica's node is not live, it's status is DOWN
+          // if replica's node is not live, its status is DOWN
           String nodeName = replicaCoreProps.getNodeName();
           if (nodeName == null || !liveNodes.contains(nodeName)) {
             replicaStatus = ZkStateReader.DOWN;
           } else {
             // query this replica directly to get doc count and assess health
-            HttpSolrServer solr = new HttpSolrServer(coreUrl);
+            HttpSolrClient solr = new HttpSolrClient(coreUrl);
             String solrUrl = solr.getBaseURL();
             q = new SolrQuery("*:*");
             q.setRows(0);
@@ -1171,9 +987,273 @@ public class SolrCLI {
       CharArr arr = new CharArr();
       new JSONWriter(arr, 2).write(report);
       System.out.println(arr.toString());
+
+      return 0;
     }
   } // end HealthcheckTool
 
+  /**
+   * Supports create_collection command in the bin/solr script.
+   */
+  public static class CreateCollectionTool implements Tool {
+
+    @Override
+    public String getName() {
+      return "create_collection";
+    }
+
+    @SuppressWarnings("static-access")
+    @Override
+    public Option[] getOptions() {
+      return new Option[] {
+          OptionBuilder
+              .withArgName("HOST")
+              .hasArg()
+              .isRequired(false)
+              .withDescription("Address of the Zookeeper ensemble; defaults to: "+ZK_HOST)
+              .create("zkHost"),
+          OptionBuilder
+              .withArgName("HOST")
+              .hasArg()
+              .isRequired(false)
+              .withDescription("Base Solr URL, which can be used to determine the zkHost if that's not known")
+              .create("solrUrl"),
+          OptionBuilder
+              .withArgName("NAME")
+              .hasArg()
+              .isRequired(true)
+              .withDescription("Name of collection to create.")
+              .create("name"),
+          OptionBuilder
+              .withArgName("#")
+              .hasArg()
+              .isRequired(false)
+              .withDescription("Number of shards; default is 1")
+              .create("shards"),
+          OptionBuilder
+              .withArgName("#")
+              .hasArg()
+              .isRequired(false)
+              .withDescription("Number of copies of each document across the collection (replicas per shard); default is 1")
+              .create("replicationFactor"),
+          OptionBuilder
+              .withArgName("#")
+              .hasArg()
+              .isRequired(false)
+              .withDescription("Maximum number of shards per Solr node; default is determined based on the number of shards, replication factor, and live nodes.")
+              .create("maxShardsPerNode"),
+          OptionBuilder
+              .withArgName("NAME")
+              .hasArg()
+              .isRequired(false)
+              .withDescription("Name of the configuration for this collection; default is "+DEFAULT_CONFIG_SET)
+              .create("config"),
+          OptionBuilder
+              .withArgName("DIR")
+              .hasArg()
+              .isRequired(true)
+              .withDescription("Path to configsets directory on the local system.")
+              .create("configsetsDir")
+      };
+    }
+
+    public int runTool(CommandLine cli) throws Exception {
+
+      // quiet down the ZK logging for cli tools
+      LogManager.getLogger("org.apache.zookeeper").setLevel(Level.ERROR);
+      LogManager.getLogger("org.apache.solr.common.cloud").setLevel(Level.WARN);
+
+      String zkHost = cli.getOptionValue("zkHost");
+      if (zkHost == null) {
+        // find it using the localPort
+        String solrUrl = cli.getOptionValue("solrUrl");
+        if (solrUrl == null)
+          throw new IllegalStateException(
+              "Must provide either the -zkHost or -solrUrl parameters to use the create_collection command!");
+
+        if (!solrUrl.endsWith("/"))
+          solrUrl += "/";
+
+        String systemInfoUrl = solrUrl+"admin/info/system";
+        HttpClient httpClient = getHttpClient();
+        try {
+          // hit Solr to get system info
+          Map<String,Object> systemInfo = getJson(httpClient, systemInfoUrl, 2);
+
+          // convert raw JSON into user-friendly output
+          StatusTool statusTool = new StatusTool();
+          Map<String,Object> status = statusTool.reportStatus(solrUrl, systemInfo, httpClient);
+
+          Map<String,Object> cloud = (Map<String, Object>)status.get("cloud");
+          if (cloud == null) {
+            System.err.println("\nERROR: Solr at "+solrUrl+
+                " is running in standalone server mode, please use the create_core command instead;\n" +
+                "create_collection can only be used when running in SolrCloud mode.\n");
+            return 1;
+          }
+
+          String zookeeper = (String) cloud.get("ZooKeeper");
+          if (zookeeper.endsWith("(embedded)")) {
+            zookeeper = zookeeper.substring(0,zookeeper.length()-"(embedded)".length());
+          }
+          zkHost = zookeeper;
+        } finally {
+          closeHttpClient(httpClient);
+        }
+      }
+
+      int toolExitStatus = 0;
+      CloudSolrClient cloudSolrServer = null;
+      try {
+        cloudSolrServer = new CloudSolrClient(zkHost);
+        System.out.println("Connecting to ZooKeeper at " + zkHost);
+        cloudSolrServer.connect();
+        toolExitStatus = runCloudTool(cloudSolrServer, cli);
+      } catch (Exception exc) {
+        // since this is a CLI, spare the user the stacktrace
+        String excMsg = exc.getMessage();
+        if (excMsg != null) {
+          System.err.println("\nERROR: "+excMsg+"\n");
+          toolExitStatus = 1;
+        } else {
+          throw exc;
+        }
+      } finally {
+        if (cloudSolrServer != null) {
+          try {
+            cloudSolrServer.shutdown();
+          } catch (Exception ignore) {}
+        }
+      }
+
+      return toolExitStatus;
+    }
+
+    protected int runCloudTool(CloudSolrClient cloudSolrClient, CommandLine cli) throws Exception {
+      Set<String> liveNodes = cloudSolrClient.getZkStateReader().getClusterState().getLiveNodes();
+      if (liveNodes.isEmpty())
+        throw new IllegalStateException("No live nodes found! Cannot create a collection until " +
+            "there is at least 1 live node in the cluster.");
+      String firstLiveNode = liveNodes.iterator().next();
+
+      // build a URL to create the collection
+      int numShards = optionAsInt(cli, "shards", 1);
+      int replicationFactor = optionAsInt(cli, "replicationFactor", 1);
+      int maxShardsPerNode = -1;
+
+      if (cli.hasOption("maxShardsPerNode")) {
+        maxShardsPerNode = Integer.parseInt(cli.getOptionValue("maxShardsPerNode"));
+      } else {
+        // need number of live nodes to determine maxShardsPerNode if it is not set
+        int numNodes = liveNodes.size();
+        maxShardsPerNode = ((numShards*replicationFactor)+numNodes-1)/numNodes;
+      }
+
+      String configSet = cli.getOptionValue("config", DEFAULT_CONFIG_SET);
+      String configSetNameInZk = configSet;
+      File configSetDir = null;
+      // we try to be flexible and allow the user to specify a configuration directory instead of a configset name
+      File possibleConfigDir = new File(configSet);
+      if (possibleConfigDir.isDirectory()) {
+        configSetDir = possibleConfigDir;
+        configSetNameInZk = possibleConfigDir.getName();
+      } else {
+        File configsetsDir = new File(cli.getOptionValue("configsetsDir"));
+        if (!configsetsDir.isDirectory())
+          throw new FileNotFoundException(configsetsDir.getAbsolutePath()+" not found!");
+
+        // upload the configset if it exists
+        configSetDir = new File(configsetsDir, configSet);
+        if (!configSetDir.isDirectory()) {
+          throw new FileNotFoundException("Specified config " + configSet +
+              " not found in " + configsetsDir.getAbsolutePath());
+        }
+      }
+
+      File confDir = new File(configSetDir, "conf");
+      if (!confDir.isDirectory()) {
+        // config dir should contain a conf sub-directory but if not and there's a solrconfig.xml, then use it
+        if ((new File(configSetDir, "solrconfig.xml")).isFile()) {
+          confDir = configSetDir;
+        } else {
+          System.err.println("Specified configuration directory "+configSetDir.getAbsolutePath()+
+              " is invalid;\nit should contain either conf sub-directory or solrconfig.xml");
+          return 1;
+        }
+      }
+
+      // test to see if that config exists in ZK
+      if (!cloudSolrClient.getZkStateReader().getZkClient().exists("/configs/"+configSetNameInZk, true)) {
+        System.out.println("Uploading "+confDir.getAbsolutePath()+
+            " for config "+configSetNameInZk+" to ZooKeeper at "+cloudSolrClient.getZkHost());
+        ZkController.uploadConfigDir(cloudSolrClient.getZkStateReader().getZkClient(), confDir, configSetNameInZk);
+      }
+
+      String baseUrl = cloudSolrClient.getZkStateReader().getBaseUrlForNodeName(firstLiveNode);
+      String collectionName = cli.getOptionValue("name");
+
+      // since creating a collection is a heavy-weight operation, check for existence first
+      String collectionListUrl = baseUrl+"/admin/collections?action=list";
+      if (safeCheckCollectionExists(collectionListUrl, collectionName)) {
+        System.err.println("\nCollection '"+collectionName+"' already exists!");
+        System.err.println("\nChecked collection existence using Collections API command:\n"+collectionListUrl);
+        System.err.println();
+        return 1;
+      }
+
+      // doesn't seem to exist ... try to create
+      String createCollectionUrl =
+          String.format(Locale.ROOT,
+              "%s/admin/collections?action=CREATE&name=%s&numShards=%d&replicationFactor=%d&maxShardsPerNode=%d&collection.configName=%s",
+              baseUrl,
+              collectionName,
+              numShards,
+              replicationFactor,
+              maxShardsPerNode,
+              configSetNameInZk);
+
+      System.out.println("\nCreating new collection '"+collectionName+"' using command:\n"+createCollectionUrl+"\n");
+
+      Map<String,Object> json = null;
+      try {
+        json = getJson(createCollectionUrl);
+      } catch (SolrServerException sse) {
+        // check if already exists
+        if (safeCheckCollectionExists(collectionListUrl, collectionName)) {
+          System.err.println("Collection '"+collectionName+"' already exists!");
+          System.err.println("\nChecked collection existence using Collections API command:\n"+collectionListUrl);
+        } else {
+          System.err.println("Failed to create collection '"+collectionName+"' due to: "+sse.getMessage());
+        }
+        System.err.println();
+        return 1;
+      }
+
+      CharArr arr = new CharArr();
+      new JSONWriter(arr, 2).write(json);
+      System.out.println(arr.toString());
+      System.out.println();
+
+      return 0;
+    }
+
+    protected boolean safeCheckCollectionExists(String url, String collection) {
+      boolean exists = false;
+      try {
+        Map<String,Object> existsCheckResult = getJson(url);
+        List<String> collections = (List<String>) existsCheckResult.get("collections");
+        exists = collections != null && collections.contains(collection);
+      } catch (Exception exc) {
+        // just ignore it since we're only interested in a positive result here
+      }
+      return exists;
+    }
+
+    protected int optionAsInt(CommandLine cli, String option, int defaultVal) {
+      return Integer.parseInt(cli.getOptionValue(option, String.valueOf(defaultVal)));
+    }
+  } // end CreateCollectionTool class
+
   public static class CreateCoreTool implements Tool {
 
     @Override
@@ -1221,15 +1301,20 @@ public class SolrCLI {
 
       File configsetsDir = new File(cli.getOptionValue("configsetsDir"));
       if (!configsetsDir.isDirectory())
-        throw new FileNotFoundException(configsetsDir.getAbsolutePath()+" not found!");
+        throw new FileNotFoundException(configsetsDir.getAbsolutePath() + " not found!");
 
       String configSet = cli.getOptionValue("config", DEFAULT_CONFIG_SET);
       File configSetDir = new File(configsetsDir, configSet);
-      if (!configSetDir.isDirectory())
-        throw new FileNotFoundException("Specified config "+configSet+
-            " not found in "+configsetsDir.getAbsolutePath());
-
-      File confDir = new File(configSetDir,"conf");
+      if (!configSetDir.isDirectory()) {
+        // we allow them to pass a directory instead of a configset name
+        File possibleConfigDir = new File(configSet);
+        if (possibleConfigDir.isDirectory()) {
+          configSetDir = possibleConfigDir;
+        } else {
+          throw new FileNotFoundException("Specified config " + configSet +
+              " not found in " + configsetsDir.getAbsolutePath());
+        }
+      }
 
       String coreName = cli.getOptionValue("name");
 
@@ -1246,21 +1331,42 @@ public class SolrCLI {
 
         // convert raw JSON into user-friendly output
         solrHome = (String)systemInfo.get("solr_home");
-        if (solrHome == null) {
+        if (solrHome == null)
           solrHome = configsetsDir.getParentFile().getAbsolutePath();
-        }
+
       } finally {
         closeHttpClient(httpClient);
       }
 
+      String coreStatusUrl = solrUrl+"admin/cores?action=STATUS&core="+coreName;
+      if (safeCheckCoreExists(coreStatusUrl, coreName)) {
+        System.err.println("\nCore '"+coreName+"' already exists!");
+        System.err.println("\nChecked core existence using Core API command:\n"+coreStatusUrl);
+        System.err.println();
+        return 1;
+      }
+
       File coreInstanceDir = new File(solrHome, coreName);
+      File confDir = new File(configSetDir,"conf");
       if (!coreInstanceDir.isDirectory()) {
         coreInstanceDir.mkdirs();
         if (!coreInstanceDir.isDirectory())
           throw new IOException("Failed to create new core instance directory: "+coreInstanceDir.getAbsolutePath());
-      }
 
-      FileUtils.copyDirectoryToDirectory(confDir, coreInstanceDir);
+        if (confDir.isDirectory()) {
+          FileUtils.copyDirectoryToDirectory(confDir, coreInstanceDir);
+        } else {
+          // hmmm ... the configset we're cloning doesn't have a conf sub-directory,
+          // we'll just assume it is OK if it has solrconfig.xml
+          if ((new File(configSetDir, "solrconfig.xml")).isFile()) {
+            FileUtils.copyDirectory(configSetDir, new File(coreInstanceDir, "conf"));
+          } else {
+            System.err.println("\n"+configSetDir.getAbsolutePath()+" doesn't contain a conf subdirectory or solrconfig.xml\n");
+            return 1;
+          }
+        }
+        System.out.println("\nSetup new core instance directory:\n"+coreInstanceDir.getAbsolutePath());
+      }
 
       String createCoreUrl =
           String.format(Locale.ROOT,
@@ -1269,9 +1375,24 @@ public class SolrCLI {
               coreName,
               coreName);
 
-      System.out.println("Creating new core '"+coreName+"' using command:\n\n"+createCoreUrl+"\n");
+      System.out.println("\nCreating new core '"+coreName+"' using command:\n"+createCoreUrl+"\n");
+
+      Map<String,Object> json = null;
+      try {
+        json = getJson(createCoreUrl);
+      } catch (SolrServerException sse) {
+        // mostly likely the core already exists ...
+        if (safeCheckCoreExists(coreStatusUrl, coreName)) {
+          // core already exists
+          System.err.println("Core '"+coreName+"' already exists!");
+          System.err.println("\nChecked core existence using Core API command:\n"+coreStatusUrl);
+        } else {
+          System.err.println("Failed to create core '"+coreName+"' due to: "+sse.getMessage());
+        }
+        System.err.println();
+        return 1;
+      }
 
-      Map<String,Object> json = getJson(createCoreUrl);
       CharArr arr = new CharArr();
       new JSONWriter(arr, 2).write(json);
       System.out.println(arr.toString());
@@ -1279,5 +1400,18 @@ public class SolrCLI {
 
       return 0;
     }
+
+    protected boolean safeCheckCoreExists(String coreStatusUrl, String coreName) {
+      boolean exists = false;
+      try {
+        Map<String,Object> existsCheckResult = getJson(coreStatusUrl);
+        Map<String,Object> status = (Map<String, Object>)existsCheckResult.get("status");
+        Map<String,Object> coreStatus = (Map<String, Object>)status.get(coreName);
+        exists = coreStatus != null && coreStatus.containsKey("name");
+      } catch (Exception exc) {
+        // just ignore it since we're only interested in a positive result here
+      }
+      return exists;
+    }
   } // end CreateCoreTool class
 }

Modified: lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/java/org/apache/solr/util/SolrPluginUtils.java Sun Jan  4 14:53:12 2015
@@ -44,11 +44,13 @@ import org.apache.solr.common.SolrDocume
 import org.apache.solr.common.SolrDocumentList;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.params.CommonParams;
+import org.apache.solr.common.params.MapSolrParams;
 import org.apache.solr.common.params.SolrParams;
 import org.apache.solr.common.util.NamedList;
 import org.apache.solr.common.util.SimpleOrderedMap;
 import org.apache.solr.common.util.StrUtils;
 import org.apache.solr.core.InitParams;
+import org.apache.solr.core.RequestParams;
 import org.apache.solr.core.SolrCore;
 import org.apache.solr.handler.component.HighlightComponent;
 import org.apache.solr.handler.component.ResponseBuilder;
@@ -97,7 +99,7 @@ public class SolrPluginUtils {
   static {
       Map<Integer, String> map = new TreeMap<>();
       map.put(ShardRequest.PURPOSE_PRIVATE, "PRIVATE");
-      map.put(ShardRequest.PURPOSE_GET_TERM_DFS, "GET_TERM_DFS");
+      map.put(ShardRequest.PURPOSE_GET_TERM_STATS, "GET_TERM_STATS");
       map.put(ShardRequest.PURPOSE_GET_TOP_IDS, "GET_TOP_IDS");
       map.put(ShardRequest.PURPOSE_REFINE_TOP_IDS, "REFINE_TOP_IDS");
       map.put(ShardRequest.PURPOSE_GET_FACETS, "GET_FACETS");
@@ -109,6 +111,7 @@ public class SolrPluginUtils {
       map.put(ShardRequest.PURPOSE_GET_TERMS, "GET_TERMS");
       map.put(ShardRequest.PURPOSE_GET_TOP_GROUPS, "GET_TOP_GROUPS");
       map.put(ShardRequest.PURPOSE_GET_MLT_RESULTS, "GET_MLT_RESULTS");
+      map.put(ShardRequest.PURPOSE_SET_TERM_STATS, "SET_TERM_STATS");
       purposes = Collections.unmodifiableMap(map);
   }
 
@@ -125,14 +128,16 @@ public class SolrPluginUtils {
    */
   public static void setDefaults(SolrQueryRequest req, SolrParams defaults,
                                  SolrParams appends, SolrParams invariants) {
-      String useParams = req.getParams().get("useParam");
-      if(useParams !=null){
-        for (String name : StrUtils.splitSmart(useParams,',')) {
-          InitParams initParams = req.getCore().getSolrConfig().getInitParams().get(name);
-          if(initParams !=null){
-            if(initParams.defaults != null) defaults = SolrParams.wrapDefaults(SolrParams.toSolrParams(initParams.defaults) , defaults);
-            if(initParams.invariants != null) invariants = SolrParams.wrapDefaults(invariants, SolrParams.toSolrParams(initParams.invariants));
-            if(initParams.appends != null)  appends = SolrParams.wrapAppended(appends, SolrParams.toSolrParams(initParams.appends));
+
+    List<String> paramNames =null;
+    String useParams = req.getParams().get(RequestParams.USEPARAM);
+    if(useParams == null) useParams = (String) req.getContext().get(RequestParams.USEPARAM);
+    if(useParams !=null) paramNames = StrUtils.splitSmart(useParams, ',');
+    if(paramNames != null){
+        for (String name : paramNames) {
+          SolrParams requestParams = req.getCore().getSolrConfig().getRequestParams().getParams(name);
+          if(requestParams !=null){
+            defaults = SolrParams.wrapDefaults(requestParams , defaults);
           }
         }
       }
@@ -265,7 +270,7 @@ public class SolrPluginUtils {
    * <li>parsedquery - the main query executed formated by the Solr
    *     QueryParsing utils class (which knows about field types)
    * </li>
-   * <li>parsedquery_toString - the main query executed formated by it's
+   * <li>parsedquery_toString - the main query executed formatted by its
    *     own toString method (in case it has internal state Solr
    *     doesn't know about)
    * </li>
@@ -700,7 +705,7 @@ public class SolrPluginUtils {
   }
 
   /**
-   * Returns it's input if there is an even (ie: balanced) number of
+   * Returns its input if there is an even (ie: balanced) number of
    * '"' characters -- otherwise returns a String in which all '"'
    * characters are striped out.
    */
@@ -757,7 +762,7 @@ public class SolrPluginUtils {
     protected Map<String,Alias> aliases = new HashMap<>(3);
     public DisjunctionMaxQueryParser(QParser qp, String defaultField) {
       super(qp,defaultField);
-      // don't trust that our parent class won't ever change it's default
+      // don't trust that our parent class won't ever change its default
       setDefaultOperator(QueryParser.Operator.OR);
     }
 

Modified: lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/analysisconfs/analysis-err-schema.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/analysisconfs/analysis-err-schema.xml?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/analysisconfs/analysis-err-schema.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/analysisconfs/analysis-err-schema.xml Sun Jan  4 14:53:12 2015
@@ -22,14 +22,14 @@
 
 <schema name="test" version="1.5">
   <types>
-    <fieldtype name="long" class="solr.TrieLongField" stored="true" indexed="true" />
-    <fieldtype name="int" class="solr.TrieIntField" precisionStep="0"/>
-    <fieldtype name="text" class="solr.TextField">
+    <fieldType name="long" class="solr.TrieLongField" stored="true" indexed="true" />
+    <fieldType name="int" class="solr.TrieIntField" precisionStep="0"/>
+    <fieldType name="text" class="solr.TextField">
       <analyzer>
         <tokenizer class="solr.StandardTokenizerFactory"/>
         <filter class="org.apache.solr.analysis.ThrowingMockTokenFilterFactory" exceptionClassName="java.lang.RuntimeException"/>
       </analyzer>
-    </fieldtype>
+    </fieldType>
  </types>
 
 

Modified: lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-dup-field.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-dup-field.xml?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-dup-field.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-dup-field.xml Sun Jan  4 14:53:12 2015
@@ -19,7 +19,7 @@
 <schema name="bad-schema-dup-field" version="1.0">
   <types>
     <fieldType name="string" class="solr.StrField"/>
-    <fieldtype name="text" class="solr.TextField" />
+    <fieldType name="text" class="solr.TextField" />
  </types>
 
 

Modified: lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-dup-fieldType.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-dup-fieldType.xml?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-dup-fieldType.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-dup-fieldType.xml Sun Jan  4 14:53:12 2015
@@ -19,7 +19,7 @@
 <schema name="bad-schema-dup-fieldType" version="1.0">
   <types>
     
-    <fieldtype name="text" class="solr.TextField" />
+    <fieldType name="text" class="solr.TextField" />
     <fieldType name="string" class="solr.StrField"/>
     
     <!-- BEGIN BAD STUFF -->

Modified: lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-misplaced-asterisk-copyfield-dest-should-fail-test.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-misplaced-asterisk-copyfield-dest-should-fail-test.xml?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-misplaced-asterisk-copyfield-dest-should-fail-test.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-misplaced-asterisk-copyfield-dest-should-fail-test.xml Sun Jan  4 14:53:12 2015
@@ -18,7 +18,7 @@
 
 <schema name="test" version="1.5">
   <types>
-    <fieldtype name="string" class="solr.StrField" sortMissingLast="true"/>
+    <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
   </types>
   <fields>
     <field name="text" type="string" indexed="true" stored="true"/>

Modified: lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-misplaced-asterisk-copyfield-source-should-fail-test.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-misplaced-asterisk-copyfield-source-should-fail-test.xml?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-misplaced-asterisk-copyfield-source-should-fail-test.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-misplaced-asterisk-copyfield-source-should-fail-test.xml Sun Jan  4 14:53:12 2015
@@ -18,7 +18,7 @@
 
 <schema name="test" version="1.5">
   <types>
-    <fieldtype name="string" class="solr.StrField" sortMissingLast="true"/>
+    <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
   </types>
   <fields>
     <field name="text" type="string" indexed="true" stored="true"/>

Modified: lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-multiple-asterisk-copyfield-dest-should-fail-test.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-multiple-asterisk-copyfield-dest-should-fail-test.xml?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-multiple-asterisk-copyfield-dest-should-fail-test.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-multiple-asterisk-copyfield-dest-should-fail-test.xml Sun Jan  4 14:53:12 2015
@@ -18,7 +18,7 @@
 
 <schema name="test" version="1.5">
   <types>
-    <fieldtype name="string" class="solr.StrField" sortMissingLast="true"/>
+    <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
   </types>
   <fields>
     <field name="text" type="string" indexed="true" stored="true"/>

Modified: lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-multiple-asterisk-copyfield-source-should-fail-test.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-multiple-asterisk-copyfield-source-should-fail-test.xml?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-multiple-asterisk-copyfield-source-should-fail-test.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-multiple-asterisk-copyfield-source-should-fail-test.xml Sun Jan  4 14:53:12 2015
@@ -18,7 +18,7 @@
 
 <schema name="test" version="1.5">
   <types>
-    <fieldtype name="string" class="solr.StrField" sortMissingLast="true"/>
+    <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
   </types>
   <fields>
     <field name="text" type="string" indexed="true" stored="true"/>

Modified: lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-non-glob-copyfield-source-matching-nothing-should-fail-test.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-non-glob-copyfield-source-matching-nothing-should-fail-test.xml?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-non-glob-copyfield-source-matching-nothing-should-fail-test.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/bad-schema-non-glob-copyfield-source-matching-nothing-should-fail-test.xml Sun Jan  4 14:53:12 2015
@@ -18,7 +18,7 @@
 
 <schema name="test" version="1.5">
   <types>
-    <fieldtype name="string" class="solr.StrField" sortMissingLast="true"/>
+    <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
   </types>
 
 

Modified: lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-add-schema-fields-update-processor.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-add-schema-fields-update-processor.xml?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-add-schema-fields-update-processor.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-add-schema-fields-update-processor.xml Sun Jan  4 14:53:12 2015
@@ -23,8 +23,8 @@
   <fieldType name="tlong" class="solr.TrieLongField" precisionStep="8" multiValued="true" positionIncrementGap="0"/>
   <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" multiValued="true" positionIncrementGap="0"/>
   <fieldType name="tdate" class="solr.TrieDateField" precisionStep="6" multiValued="true" positionIncrementGap="0"/>
-  <fieldtype name="boolean" class="solr.BoolField" sortMissingLast="true" multiValued="true"/>
-  <fieldtype name="string" class="solr.StrField" sortMissingLast="true"/>
+  <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true" multiValued="true"/>
+  <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
   <fieldType name="long" class="solr.TrieLongField" precisionStep="0" positionIncrementGap="0"/>
   <fieldType name="text" class="solr.TextField" multiValued="true" positionIncrementGap="100">
     <analyzer>

Modified: lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-binaryfield.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-binaryfield.xml?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-binaryfield.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-binaryfield.xml Sun Jan  4 14:53:12 2015
@@ -31,7 +31,7 @@
     <!-- field type definitions... note that the "name" attribute is
          just a label to be used by field definitions.  The "class"
          attribute and any other attributes determine the real type and
-         behavior of the fieldtype.
+         behavior of the fieldType.
       -->
 
     <!--
@@ -58,14 +58,14 @@
     <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/>
 
 
-    <fieldtype name="binary" class="solr.BinaryField"/>
-    <fieldtype name="boolean" class="solr.BoolField" sortMissingLast="true"/>
-    <fieldtype name="string" class="solr.StrField" sortMissingLast="true"/>
+    <fieldType name="binary" class="solr.BinaryField"/>
+    <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
+    <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
 
     <!-- format for date is 1995-12-31T23:59:59.999Z and only the fractional
          seconds part (.999) is optional.
       -->
-    <fieldtype name="date" class="solr.TrieDateField" sortMissingLast="true"/>
+    <fieldType name="date" class="solr.TrieDateField" sortMissingLast="true"/>
 
 
 

Modified: lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-class-name-shortening-on-serialization.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-class-name-shortening-on-serialization.xml?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-class-name-shortening-on-serialization.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-class-name-shortening-on-serialization.xml Sun Jan  4 14:53:12 2015
@@ -17,23 +17,23 @@
 -->
 <schema name="test-class-name-shortening-on-serialization" version="1.5">
   <types>
-    <fieldtype name="fullClassNames" class="org.apache.solr.schema.TextField">
+    <fieldType name="fullClassNames" class="org.apache.solr.schema.TextField">
       <analyzer>
         <charFilter class="org.apache.solr.analysis.MockCharFilterFactory" remainder="0"/>
         <tokenizer class="org.apache.solr.analysis.MockTokenizerFactory"/>
         <filter class="org.apache.solr.analysis.MockTokenFilterFactory" stopset="empty"/>
       </analyzer>
       <similarity class="org.apache.lucene.misc.SweetSpotSimilarity"/>
-    </fieldtype>
-    <fieldtype name="shortenedClassNames" class="solr.TextField">
+    </fieldType>
+    <fieldType name="shortenedClassNames" class="solr.TextField">
       <analyzer>
         <charFilter class="solr.MockCharFilterFactory" remainder="0"/>
         <tokenizer class="solr.MockTokenizerFactory"/>
         <filter class="solr.MockTokenFilterFactory" stopset="empty"/>
       </analyzer>
       <similarity class="solr.SweetSpotSimilarityFactory"/>
-    </fieldtype>
-    <fieldtype name="string" class="solr.StrField" sortMissingLast="true"/>
+    </fieldType>
+    <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
   </types>
   <fields>
     <field name="id" type="string" indexed="true" stored="true" multiValued="false" required="true"/>

Modified: lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-collate-dv.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-collate-dv.xml?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-collate-dv.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-collate-dv.xml Sun Jan  4 14:53:12 2015
@@ -23,19 +23,19 @@
     <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
 
     <!-- basic text field -->
-    <fieldtype name="text" class="solr.TextField">
+    <fieldType name="text" class="solr.TextField">
       <analyzer>
         <tokenizer class="solr.StandardTokenizerFactory"/>
         <filter class="solr.LowerCaseFilterFactory"/>
       </analyzer>
-    </fieldtype>
+    </fieldType>
     
-    <fieldtype name="sort_ar_t"       class="solr.CollationField" language="ar"/>
-    <fieldtype name="sort_de_t"       class="solr.CollationField" language="de" strength="primary"/>
-    <fieldtype name="sort_tr_canon_t" class="solr.CollationField" language="tr" strength="primary"   decomposition="canonical"/>
-    <fieldtype name="sort_zh_full_t"  class="solr.CollationField" language="zh" strength="identical" decomposition="full"/>
-    <fieldtype name="sort_da_t"       class="solr.CollationField" language="da" strength="primary"/>
-    <fieldtype name="sort_custom_t"   class="solr.CollationField" custom="customrules.dat" strength="primary"/>
+    <fieldType name="sort_ar_t"       class="solr.CollationField" language="ar"/>
+    <fieldType name="sort_de_t"       class="solr.CollationField" language="de" strength="primary"/>
+    <fieldType name="sort_tr_canon_t" class="solr.CollationField" language="tr" strength="primary"   decomposition="canonical"/>
+    <fieldType name="sort_zh_full_t"  class="solr.CollationField" language="zh" strength="identical" decomposition="full"/>
+    <fieldType name="sort_da_t"       class="solr.CollationField" language="da" strength="primary"/>
+    <fieldType name="sort_custom_t"   class="solr.CollationField" custom="customrules.dat" strength="primary"/>
   </types>
 
   <fields>

Modified: lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-collate.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-collate.xml?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-collate.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-collate.xml Sun Jan  4 14:53:12 2015
@@ -23,19 +23,19 @@
     <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
 
     <!-- basic text field -->
-    <fieldtype name="text" class="solr.TextField">
+    <fieldType name="text" class="solr.TextField">
       <analyzer>
         <tokenizer class="solr.StandardTokenizerFactory"/>
         <filter class="solr.LowerCaseFilterFactory"/>
       </analyzer>
-    </fieldtype>
+    </fieldType>
     
-    <fieldtype name="sort_ar_t"       class="solr.CollationField" language="ar"/>
-    <fieldtype name="sort_de_t"       class="solr.CollationField" language="de" strength="primary"/>
-    <fieldtype name="sort_tr_canon_t" class="solr.CollationField" language="tr" strength="primary"   decomposition="canonical"/>
-    <fieldtype name="sort_zh_full_t"  class="solr.CollationField" language="zh" strength="identical" decomposition="full"/>
-    <fieldtype name="sort_da_t"       class="solr.CollationField" language="da" strength="primary"/>
-    <fieldtype name="sort_custom_t"   class="solr.CollationField" custom="customrules.dat" strength="primary"/>
+    <fieldType name="sort_ar_t"       class="solr.CollationField" language="ar"/>
+    <fieldType name="sort_de_t"       class="solr.CollationField" language="de" strength="primary"/>
+    <fieldType name="sort_tr_canon_t" class="solr.CollationField" language="tr" strength="primary"   decomposition="canonical"/>
+    <fieldType name="sort_zh_full_t"  class="solr.CollationField" language="zh" strength="identical" decomposition="full"/>
+    <fieldType name="sort_da_t"       class="solr.CollationField" language="da" strength="primary"/>
+    <fieldType name="sort_custom_t"   class="solr.CollationField" custom="customrules.dat" strength="primary"/>
   </types>
 
   <fields>

Modified: lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-complex-phrase.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-complex-phrase.xml?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-complex-phrase.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-complex-phrase.xml Sun Jan  4 14:53:12 2015
@@ -20,9 +20,9 @@
 
     <fieldType name="int" class="solr.TrieIntField" precisionStep="0" omitNorms="true" positionIncrementGap="0"/>
 
-    <fieldtype name="nametext" class="solr.TextField">
+    <fieldType name="nametext" class="solr.TextField">
       <analyzer class="org.apache.lucene.analysis.standard.StandardAnalyzer"/>
-    </fieldtype>
+    </fieldType>
   </types>
 
   <fields>

Modified: lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-copyfield-test.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-copyfield-test.xml?rev=1649347&r1=1649346&r2=1649347&view=diff
==============================================================================
--- lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-copyfield-test.xml (original)
+++ lucene/dev/branches/lucene6005/solr/core/src/test-files/solr/collection1/conf/schema-copyfield-test.xml Sun Jan  4 14:53:12 2015
@@ -31,7 +31,7 @@
     <!-- field type definitions... note that the "name" attribute is
          just a label to be used by field definitions.  The "class"
          attribute and any other attributes determine the real type and
-         behavior of the fieldtype.
+         behavior of the fieldType.
       -->
 
     <!--
@@ -58,40 +58,40 @@
     <fieldType name="tdouble" class="solr.TrieDoubleField" precisionStep="8" positionIncrementGap="0"/>
 
     <!-- Field type demonstrating an Analyzer failure -->
-    <fieldtype name="failtype1" class="solr.TextField">
+    <fieldType name="failtype1" class="solr.TextField">
       <analyzer type="index">
           <tokenizer class="solr.MockTokenizerFactory"/>
           <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="0" catenateWords="0" catenateNumbers="0" catenateAll="0"/>
           <filter class="solr.LowerCaseFilterFactory"/>
       </analyzer>
-    </fieldtype>
+    </fieldType>
 
     <!-- Demonstrating ignoreCaseChange -->
-    <fieldtype name="wdf_nocase" class="solr.TextField">
+    <fieldType name="wdf_nocase" class="solr.TextField">
       <analyzer>
           <tokenizer class="solr.MockTokenizerFactory"/>
           <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="0" catenateWords="0" catenateNumbers="0" catenateAll="0" splitOnCaseChange="0"/>
           <filter class="solr.LowerCaseFilterFactory"/>
       </analyzer>
-    </fieldtype>
+    </fieldType>
 
 
     <!-- HighlitText optimizes storage for (long) columns which will be highlit -->
-    <fieldtype name="highlittext" class="solr.TextField" compressThreshold="345" />
+    <fieldType name="highlittext" class="solr.TextField" compressThreshold="345" />
 
-    <fieldtype name="boolean" class="solr.BoolField" sortMissingLast="true"/>
-    <fieldtype name="string" class="solr.StrField" sortMissingLast="true"/>
+    <fieldType name="boolean" class="solr.BoolField" sortMissingLast="true"/>
+    <fieldType name="string" class="solr.StrField" sortMissingLast="true"/>
 
     <!-- format for date is 1995-12-31T23:59:59.999Z and only the fractional
          seconds part (.999) is optional.
       -->
-    <fieldtype name="date" class="solr.TrieDateField" sortMissingLast="true"/>
+    <fieldType name="date" class="solr.TrieDateField" sortMissingLast="true"/>
 
     <!-- solr.TextField allows the specification of custom
          text analyzers specified as a tokenizer and a list
          of token filters.
       -->
-    <fieldtype name="text" class="solr.TextField">
+    <fieldType name="text" class="solr.TextField">
       <analyzer>
         <tokenizer class="solr.StandardTokenizerFactory"/>
         <filter class="solr.StandardFilterFactory"/>
@@ -99,68 +99,68 @@
         <filter class="solr.StopFilterFactory"/>
         <filter class="solr.PorterStemFilterFactory"/>
       </analyzer>
-    </fieldtype>
+    </fieldType>
 
 
-    <fieldtype name="nametext" class="solr.TextField">
+    <fieldType name="nametext" class="solr.TextField">
       <analyzer class="org.apache.lucene.analysis.core.WhitespaceAnalyzer"/>
-    </fieldtype>
+    </fieldType>
 
-    <fieldtype name="teststop" class="solr.TextField">
+    <fieldType name="teststop" class="solr.TextField">
        <analyzer>
         <tokenizer class="solr.LowerCaseTokenizerFactory"/>
         <filter class="solr.StandardFilterFactory"/>
         <filter class="solr.StopFilterFactory" words="stopwords.txt"/>
       </analyzer>
-    </fieldtype>
+    </fieldType>
 
-    <!-- fieldtypes in this section isolate tokenizers and tokenfilters for testing -->
-    <fieldtype name="lowertok" class="solr.TextField">
+    <!-- fieldTypes in this section isolate tokenizers and tokenfilters for testing -->
+    <fieldType name="lowertok" class="solr.TextField">
       <analyzer><tokenizer class="solr.LowerCaseTokenizerFactory"/></analyzer>
-    </fieldtype>
-    <fieldtype name="keywordtok" class="solr.TextField">
+    </fieldType>
+    <fieldType name="keywordtok" class="solr.TextField">
       <analyzer><tokenizer class="solr.MockTokenizerFactory" pattern="keyword"/></analyzer>
-    </fieldtype>
-    <fieldtype name="standardtok" class="solr.TextField">
+    </fieldType>
+    <fieldType name="standardtok" class="solr.TextField">
       <analyzer><tokenizer class="solr.StandardTokenizerFactory"/></analyzer>
-    </fieldtype>
-    <fieldtype name="lettertok" class="solr.TextField">
+    </fieldType>
+    <fieldType name="lettertok" class="solr.TextField">
       <analyzer><tokenizer class="solr.LetterTokenizerFactory"/></analyzer>
-    </fieldtype>
-    <fieldtype name="whitetok" class="solr.TextField">
+    </fieldType>
+    <fieldType name="whitetok" class="solr.TextField">
       <analyzer><tokenizer class="solr.MockTokenizerFactory"/></analyzer>
-    </fieldtype>
-    <fieldtype name="HTMLstandardtok" class="solr.TextField">
+    </fieldType>
+    <fieldType name="HTMLstandardtok" class="solr.TextField">
       <analyzer>
       <charFilter class="solr.HTMLStripCharFilterFactory"/>
       <tokenizer class="solr.StandardTokenizerFactory"/>
       </analyzer>
-    </fieldtype>
-    <fieldtype name="HTMLwhitetok" class="solr.TextField">
+    </fieldType>
+    <fieldType name="HTMLwhitetok" class="solr.TextField">
       <analyzer>
       <charFilter class="solr.HTMLStripCharFilterFactory"/>
       <tokenizer class="solr.MockTokenizerFactory"/>
       </analyzer>
-    </fieldtype>
-    <fieldtype name="standardtokfilt" class="solr.TextField">
+    </fieldType>
+    <fieldType name="standardtokfilt" class="solr.TextField">
       <analyzer>
         <tokenizer class="solr.StandardTokenizerFactory"/>
         <filter class="solr.StandardFilterFactory"/>
       </analyzer>
-    </fieldtype>
-    <fieldtype name="standardfilt" class="solr.TextField">
+    </fieldType>
+    <fieldType name="standardfilt" class="solr.TextField">
       <analyzer>
         <tokenizer class="solr.MockTokenizerFactory"/>
         <filter class="solr.StandardFilterFactory"/>
       </analyzer>
-    </fieldtype>
-    <fieldtype name="lowerfilt" class="solr.TextField">
+    </fieldType>
+    <fieldType name="lowerfilt" class="solr.TextField">
       <analyzer>
         <tokenizer class="solr.MockTokenizerFactory"/>
         <filter class="solr.LowerCaseFilterFactory"/>
       </analyzer>
-    </fieldtype>
-    <fieldtype name="patternreplacefilt" class="solr.TextField">
+    </fieldType>
+    <fieldType name="patternreplacefilt" class="solr.TextField">
       <analyzer type="index">
         <tokenizer class="solr.MockTokenizerFactory" pattern="keyword"/>
         <filter class="solr.PatternReplaceFilterFactory"
@@ -170,52 +170,52 @@
       <analyzer type="query">
         <tokenizer class="solr.MockTokenizerFactory" pattern="keyword"/>
       </analyzer>
-    </fieldtype>
-    <fieldtype name="porterfilt" class="solr.TextField">
+    </fieldType>
+    <fieldType name="porterfilt" class="solr.TextField">
       <analyzer>
         <tokenizer class="solr.MockTokenizerFactory"/>
         <filter class="solr.PorterStemFilterFactory"/>
       </analyzer>
-    </fieldtype>
-    <!-- fieldtype name="snowballfilt" class="solr.TextField">
+    </fieldType>
+    <!-- fieldType name="snowballfilt" class="solr.TextField">
       <analyzer>
         <tokenizer class="solr.MockTokenizerFactory"/>
         <filter class="solr.SnowballPorterFilterFactory"/>
       </analyzer>
-    </fieldtype -->
-    <fieldtype name="engporterfilt" class="solr.TextField">
+    </fieldType -->
+    <fieldType name="engporterfilt" class="solr.TextField">
       <analyzer>
         <tokenizer class="solr.MockTokenizerFactory"/>
         <filter class="solr.PorterStemFilterFactory"/>
       </analyzer>
-    </fieldtype>
-    <fieldtype name="custengporterfilt" class="solr.TextField">
+    </fieldType>
+    <fieldType name="custengporterfilt" class="solr.TextField">
       <analyzer>
         <tokenizer class="solr.MockTokenizerFactory"/>
         <filter class="solr.KeywordMarkerFilterFactory" protected="protwords.txt"/>
         <filter class="solr.PorterStemFilterFactory"/>
       </analyzer>
-    </fieldtype>
-    <fieldtype name="stopfilt" class="solr.TextField">
+    </fieldType>
+    <fieldType name="stopfilt" class="solr.TextField">
       <analyzer>
         <tokenizer class="solr.MockTokenizerFactory"/>
         <filter class="solr.StopFilterFactory" ignoreCase="true"/>
       </analyzer>
-    </fieldtype>
-    <fieldtype name="custstopfilt" class="solr.TextField">
+    </fieldType>
+    <fieldType name="custstopfilt" class="solr.TextField">
       <analyzer>
         <tokenizer class="solr.MockTokenizerFactory"/>
         <filter class="solr.StopFilterFactory" words="stopwords.txt"/>
       </analyzer>
-    </fieldtype>
-    <fieldtype name="lengthfilt" class="solr.TextField">
+    </fieldType>
+    <fieldType name="lengthfilt" class="solr.TextField">
       <analyzer>
         <tokenizer class="solr.MockTokenizerFactory"/>
         <filter class="solr.LengthFilterFactory" min="2" max="5"/>
       </analyzer>
-    </fieldtype>
+    </fieldType>
 
-    <fieldtype name="subword" class="solr.TextField" multiValued="true" positionIncrementGap="100">
+    <fieldType name="subword" class="solr.TextField" multiValued="true" positionIncrementGap="100">
       <analyzer type="index">
           <tokenizer class="solr.MockTokenizerFactory"/>
           <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
@@ -230,10 +230,10 @@
           <filter class="solr.StopFilterFactory"/>
           <filter class="solr.PorterStemFilterFactory"/>
       </analyzer>
-    </fieldtype>
+    </fieldType>
 
     <!-- more flexible in matching skus, but more chance of a false match -->
-    <fieldtype name="skutype1" class="solr.TextField">
+    <fieldType name="skutype1" class="solr.TextField">
       <analyzer type="index">
           <tokenizer class="solr.MockTokenizerFactory"/>
           <filter class="solr.WordDelimiterFilterFactory" generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
@@ -244,10 +244,10 @@
           <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
           <filter class="solr.LowerCaseFilterFactory"/>
       </analyzer>
-    </fieldtype>
+    </fieldType>
 
     <!-- less flexible in matching skus, but less chance of a false match -->
-    <fieldtype name="skutype2" class="solr.TextField">
+    <fieldType name="skutype2" class="solr.TextField">
       <analyzer type="index">
           <tokenizer class="solr.MockTokenizerFactory"/>
           <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
@@ -258,20 +258,20 @@
           <filter class="solr.WordDelimiterFilterFactory" generateWordParts="0" generateNumberParts="0" catenateWords="1" catenateNumbers="1" catenateAll="0"/>
           <filter class="solr.LowerCaseFilterFactory"/>
       </analyzer>
-    </fieldtype>
+    </fieldType>
 
     <!-- less flexible in matching skus, but less chance of a false match -->
-    <fieldtype name="syn" class="solr.TextField">
+    <fieldType name="syn" class="solr.TextField">
       <analyzer>
           <tokenizer class="solr.MockTokenizerFactory"/>
           <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"/>
       </analyzer>
-    </fieldtype>
+    </fieldType>
     
     <!-- Demonstrates How RemoveDuplicatesTokenFilter makes stemmed
          synonyms "better"
       -->
-    <fieldtype name="dedup" class="solr.TextField">
+    <fieldType name="dedup" class="solr.TextField">
       <analyzer>
           <tokenizer class="solr.MockTokenizerFactory"/>
           <filter class="solr.SynonymFilterFactory"
@@ -279,17 +279,17 @@
           <filter class="solr.PorterStemFilterFactory"/>
           <filter class="solr.RemoveDuplicatesTokenFilterFactory" />
       </analyzer>
-    </fieldtype>
+    </fieldType>
 
-    <fieldtype  name="unstored" class="solr.StrField" indexed="true" stored="false"/>
+    <fieldType  name="unstored" class="solr.StrField" indexed="true" stored="false"/>
 
 
-  <fieldtype name="textgap" class="solr.TextField" multiValued="true" positionIncrementGap="100">
+  <fieldType name="textgap" class="solr.TextField" multiValued="true" positionIncrementGap="100">
       <analyzer>
           <tokenizer class="solr.MockTokenizerFactory"/>
           <filter class="solr.LowerCaseFilterFactory"/>
       </analyzer>
-  </fieldtype>
+  </fieldType>
 
  </types>