lucene-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From thelabd...@apache.org
Subject svn commit: r1635969 [1/2] - in /lucene/dev/branches/branch_5x: ./ dev-tools/ dev-tools/idea/.idea/libraries/ dev-tools/scripts/ solr/ solr/bin/ solr/core/ solr/core/src/java/org/apache/solr/util/ solr/core/src/test/org/apache/solr/cloud/ solr/core/src...
Date Sat, 01 Nov 2014 15:21:34 GMT
Author: thelabdude
Date: Sat Nov  1 15:21:32 2014
New Revision: 1635969

URL: http://svn.apache.org/r1635969
Log:
SOLR-3619: backport to 5x

Added:
    lucene/dev/branches/branch_5x/solr/server/   (props changed)
      - copied from r1635666, lucene/dev/trunk/solr/server/
Removed:
    lucene/dev/branches/branch_5x/solr/example/build.xml
    lucene/dev/branches/branch_5x/solr/example/contexts/
    lucene/dev/branches/branch_5x/solr/example/etc/
    lucene/dev/branches/branch_5x/solr/example/example-schemaless/
    lucene/dev/branches/branch_5x/solr/example/ivy.xml
    lucene/dev/branches/branch_5x/solr/example/lib/
    lucene/dev/branches/branch_5x/solr/example/logs/
    lucene/dev/branches/branch_5x/solr/example/resources/
    lucene/dev/branches/branch_5x/solr/example/scripts/
    lucene/dev/branches/branch_5x/solr/example/solr/
    lucene/dev/branches/branch_5x/solr/example/solr-webapp/
    lucene/dev/branches/branch_5x/solr/example/webapps/
Modified:
    lucene/dev/branches/branch_5x/   (props changed)
    lucene/dev/branches/branch_5x/dev-tools/   (props changed)
    lucene/dev/branches/branch_5x/dev-tools/idea/.idea/libraries/Solr_example_library.xml
    lucene/dev/branches/branch_5x/dev-tools/scripts/smokeTestRelease.py
    lucene/dev/branches/branch_5x/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/README.txt   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/bin/   (props changed)
    lucene/dev/branches/branch_5x/solr/bin/solr
    lucene/dev/branches/branch_5x/solr/bin/solr.cmd
    lucene/dev/branches/branch_5x/solr/build.xml   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/common-build.xml   (contents, props changed)
    lucene/dev/branches/branch_5x/solr/core/   (props changed)
    lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/util/SolrCLI.java
    lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/TestZkChroot.java
    lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java
    lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java
    lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java
    lucene/dev/branches/branch_5x/solr/example/   (props changed)
    lucene/dev/branches/branch_5x/solr/example/README.txt
    lucene/dev/branches/branch_5x/solr/server/lib/   (props changed)
    lucene/dev/branches/branch_5x/solr/server/logs/   (props changed)
    lucene/dev/branches/branch_5x/solr/server/solr/   (props changed)
    lucene/dev/branches/branch_5x/solr/server/solr-webapp/   (props changed)
    lucene/dev/branches/branch_5x/solr/server/solr/configsets/data_driven_schema_configs/conf/   (props changed)
    lucene/dev/branches/branch_5x/solr/server/webapps/   (props changed)
    lucene/dev/branches/branch_5x/solr/solrj/   (props changed)
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleBinaryTest.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleXMLTest.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrSchemalessExampleTest.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/TestBatchUpdate.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/JettyWebappTest.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeBinaryJettyTest.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeEmbeddedTest.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/LargeVolumeJettyTest.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleEmbeddedTest.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleJettyTest.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/embedded/SolrExampleStreamingTest.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/impl/BasicHttpSolrServerTest.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrServerTest.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/impl/ExternalHttpClientTest.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/response/NoOpResponseParserTest.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/response/TermsResponseTest.java
    lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/response/TestSpellCheckResponse.java
    lucene/dev/branches/branch_5x/solr/test-framework/   (props changed)
    lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/SolrJettyTestBase.java
    lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/util/ExternalPaths.java
    lucene/dev/branches/branch_5x/solr/test-framework/src/java/org/apache/solr/util/SSLTestConfig.java

Modified: lucene/dev/branches/branch_5x/dev-tools/idea/.idea/libraries/Solr_example_library.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/dev-tools/idea/.idea/libraries/Solr_example_library.xml?rev=1635969&r1=1635968&r2=1635969&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/dev-tools/idea/.idea/libraries/Solr_example_library.xml (original)
+++ lucene/dev/branches/branch_5x/dev-tools/idea/.idea/libraries/Solr_example_library.xml Sat Nov  1 15:21:32 2014
@@ -1,10 +1,10 @@
 <component name="libraryTable">
   <library name="Solr example library">
     <CLASSES>
-      <root url="file://$PROJECT_DIR$/solr/example/lib" />
+      <root url="file://$PROJECT_DIR$/solr/server/lib" />
     </CLASSES>
     <JAVADOC />
     <SOURCES />
-    <jarDirectory url="file://$PROJECT_DIR$/solr/example/lib" recursive="true" />
+    <jarDirectory url="file://$PROJECT_DIR$/solr/server/lib" recursive="true" />
   </library>
 </component>
\ No newline at end of file

Modified: lucene/dev/branches/branch_5x/dev-tools/scripts/smokeTestRelease.py
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/dev-tools/scripts/smokeTestRelease.py?rev=1635969&r1=1635968&r2=1635969&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/dev-tools/scripts/smokeTestRelease.py (original)
+++ lucene/dev/branches/branch_5x/dev-tools/scripts/smokeTestRelease.py Sat Nov  1 15:21:32 2014
@@ -238,7 +238,7 @@ def checkAllJARs(topDir, project, svnRev
 
     normRoot = normSlashes(root)
 
-    if project == 'solr' and normRoot.endswith('/example/lib'):
+    if project == 'solr' and normRoot.endswith('/server/lib'):
       # Solr's example intentionally ships servlet JAR:
       continue
     
@@ -771,7 +771,7 @@ def verifyUnpacked(java, project, artifa
       checkJavadocpath('%s/docs' % unpackPath)
 
     else:
-      checkSolrWAR('%s/example/webapps/solr.war' % unpackPath, svnRevision, version, tmpDir, baseURL)
+      checkSolrWAR('%s/server/webapps/solr.war' % unpackPath, svnRevision, version, tmpDir, baseURL)
 
       print('    copying unpacked distribution for Java 7 ...')
       java7UnpackPath = '%s-java7' % unpackPath
@@ -848,13 +848,18 @@ def readSolrOutput(p, startupEvent, fail
     
 def testSolrExample(unpackPath, javaPath, isSrc):
   logFile = '%s/solr-example.log' % unpackPath
-  os.chdir('example')
+  if isSrc:
+    os.chdir(unpackPath+'/solr')
+    subprocess.call(['chmod','+x',unpackPath+'/solr/bin/solr'])
+  else:
+    os.chdir(unpackPath)
+
   print('      start Solr instance (log=%s)...' % logFile)
   env = {}
   env.update(os.environ)
   env['JAVA_HOME'] = javaPath
   env['PATH'] = '%s/bin:%s' % (javaPath, env['PATH'])
-  server = subprocess.Popen(['java', '-jar', 'start.jar'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE, env=env)
+  server = subprocess.Popen(['bin/solr', '-f'], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, stdin=subprocess.PIPE, env=env)
 
   startupEvent = threading.Event()
   failureEvent = threading.Event()
@@ -876,20 +881,29 @@ def testSolrExample(unpackPath, javaPath
       raise RuntimeError('failure on startup; see log %s' % logFile)
 
     print('      startup done')
-
+    # Create the techproducts config (used to be collection1)
+    subprocess.call(['bin/solr','create_core','-n','techproducts','-c','sample_techproducts_configs'])
+    os.chdir('example')
     print('      test utf8...')
-    run('sh ./exampledocs/test_utf8.sh', 'utf8.log')
+    run('sh ./exampledocs/test_utf8.sh http://localhost:8983/solr/techproducts', 'utf8.log')
     print('      index example docs...')
-    run('sh ./exampledocs/post.sh ./exampledocs/*.xml', 'post-example-docs.log')
+    # "$JAVA" -Durl=http://localhost:$SOLR_PORT/solr/$EXAMPLE/update -jar $SOLR_TIP/example/exampledocs/post.jar $SOLR_TIP/example/exampledocs/*.xml
+    run('java -Durl=http://localhost:8983/solr/techproducts/update -jar ./exampledocs/post.jar ./exampledocs/*.xml', 'post-example-docs.log')
+    #run('sh ./exampledocs/post.sh ./exampledocs/*.xml', 'post-example-docs.log')
     print('      run query...')
-    s = urllib.request.urlopen('http://localhost:8983/solr/select/?q=video').read().decode('UTF-8')
+    s = urllib.request.urlopen('http://localhost:8983/solr/techproducts/select/?q=video').read().decode('UTF-8')
     if s.find('<result name="response" numFound="3" start="0">') == -1:
       print('FAILED: response is:\n%s' % s)
       raise RuntimeError('query on solr example instance failed')
   finally:
     # Stop server:
-    print('      stop server (SIGINT)...')
-    os.kill(server.pid, signal.SIGINT)
+    print('      stop server using: bin/solr stop -p 8983')
+    #os.kill(server.pid, signal.SIGINT)
+    if isSrc:
+      os.chdir(unpackPath+'/solr')
+    else:
+      os.chdir(unpackPath)
+    subprocess.call(['bin/solr','stop','-p','8983'])
 
     # Give it 10 seconds to gracefully shut down
     serverThread.join(10.0)
@@ -907,8 +921,11 @@ def testSolrExample(unpackPath, javaPath
 
   if failureEvent.isSet():
     raise RuntimeError('exception while reading Solr output')
-    
-  os.chdir('..')
+
+  if isSrc:
+    os.chdir(unpackPath+'/solr')
+  else:
+    os.chdir(unpackPath)
     
 # the weaker check: we can use this on java6 for some checks,
 # but its generated HTML is hopelessly broken so we cannot run

Modified: lucene/dev/branches/branch_5x/solr/README.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/README.txt?rev=1635969&r1=1635968&r2=1635969&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/README.txt (original)
+++ lucene/dev/branches/branch_5x/solr/README.txt Sat Nov  1 15:21:32 2014
@@ -28,10 +28,59 @@ http://lucene.apache.org/solr
 Getting Started
 ---------------
 
-See the "example" directory for an example Solr setup.  A tutorial
-using the example setup can be found at
+To start Solr for the first time after installation, simply do:
+
+  bin/solr start -f
+
+This will launch a Solr server in the foreground of your shell, bound
+to port 8983. Alternatively, you can launch Solr in "cloud" mode,
+which allows you to scale out using sharding and replication. To
+launch Solr in cloud mode, do:
+
+  bin/solr start -f -cloud
+
+To see all available options for starting Solr, please do:
+
+  bin/solr start -help
+
+After starting Solr, direct your Web browser to the Solr Admin Console at:
+
+  http://localhost:8983/solr/
+
+To add documents to the index, use the post.jar (or post.sh script) in
+the example/exampledocs subdirectory (while Solr is running), for example:
+
+     cd example/exampledocs
+     java -jar post.jar *.xml
+Or:  sh post.sh *.xml
+
+For more information about Solr examples please read...
+
+ * example/solr/README.txt
+   For more information about the "Solr Home" and Solr specific configuration
+ * http://lucene.apache.org/solr/tutorial.html
+   For a Tutorial using this example configuration
+ * http://wiki.apache.org/solr/SolrResources
+   For a list of other tutorials and introductory articles.
+
+
+In addition, Solr ships with several example configurations that
+help you learn about Solr. To run one of the examples, you would do:
+
+  bin/solr -e <EXAMPLE> where <EXAMPLE> is one of:
+
+    cloud        : SolrCloud example
+    dih          : Data Import Handler (rdbms, mail, rss, tika)
+    schemaless   : Schema-less example (schema is inferred from data during indexing)
+    techproducts : Kitchen sink example providing comprehensive examples of Solr features
+
+
+A tutorial is available at:
+
    http://lucene.apache.org/solr/tutorial.html
+
 or linked from "docs/index.html" in a binary distribution.
+
 Also, there are Solr clients for many programming languages, see 
    http://wiki.apache.org/solr/IntegratingSolr
 
@@ -39,11 +88,10 @@ Also, there are Solr clients for many pr
 Files included in an Apache Solr binary distribution
 ----------------------------------------------------
 
-example/
-  A self-contained example Solr instance, complete with a sample
-  configuration, documents to index, and the Jetty Servlet container.
-  Please see example/README.txt for information about running this
-  example.
+server/
+  A self-contained Solr instance, complete with a sample
+  configuration and documents to index. Please see: bin/solr start -help
+  for more information about starting a Solr server.
 
 dist/solr-XX.war
   The Apache Solr Application.  Deploy this WAR file to any servlet
@@ -89,7 +137,7 @@ Instructions for Building Apache Solr fr
   
    NOTE: 
    To see Solr in action, you may want to use the "ant example" command to build
-   and package Solr into the example/webapps directory. See also example/README.txt.
+   and package Solr into the server/webapps directory. See also server/README.txt.
 
 
 Export control

Modified: lucene/dev/branches/branch_5x/solr/bin/solr
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/bin/solr?rev=1635969&r1=1635968&r2=1635969&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/bin/solr (original)
+++ lucene/dev/branches/branch_5x/solr/bin/solr Sat Nov  1 15:21:32 2014
@@ -124,7 +124,7 @@ function print_usage() {
   if [ "$CMD" == "" ]; then
     echo ""
     echo "Usage: solr COMMAND OPTIONS"
-    echo "       where COMMAND is one of: start, stop, restart, healthcheck"
+    echo "       where COMMAND is one of: start, stop, restart, healthcheck, create_core, create_collection"
     echo ""
     echo "  Standalone server example (start Solr running in the background on port 8984):"
     echo ""
@@ -168,10 +168,9 @@ function print_usage() {
     echo ""
     echo "  -e <example>  Name of the example to run; available examples:"
     echo "      cloud:         SolrCloud example"
-    echo "      default:       Solr default example"
+    echo "      techproducts:  Comprehensive example illustrating many of Solr's core capabilities"
     echo "      dih:           Data Import Handler"
     echo "      schemaless:    Schema-less example"
-    echo "      multicore:     Multicore"
     echo ""
     echo "  -a            Additional parameters to pass to the JVM when starting Solr, such as to setup"
     echo "                Java debug options. For example, to enable a Java debugger to attach to the Solr JVM"
@@ -204,6 +203,37 @@ function print_usage() {
     echo ""
     echo "  -z <zkHost>      ZooKeeper connection string; default is localhost:9983"
     echo ""
+  elif [ "$CMD" == "create_core" ]; then
+    echo ""
+    echo "Usage: solr create_core [-n name] [-c configset]"
+    echo ""
+    echo "  -n <name>       Name of core to create"
+    echo ""
+    echo "  -c <configset>  Name of configuration directory to use, valid options are:"
+    echo "      basic_configs: Minimal Solr configuration"
+    echo "      data_driven_schema_configs: Managed schema with field-guessing support enabled"
+    echo "      sample_techproducts_configs: Example configuration with many optional features enabled to"
+    echo "         demonstrate the full power of Solr"
+    echo "      If not specified, default is: data_driven_schema_configs"
+    echo ""
+  elif [ "$CMD" == "create_collection" ]; then
+    echo ""
+    echo "Usage: solr create_collection [-n name] [-c configset] [-shards #] [-replicationFactor #]"
+    echo ""
+    echo "  -n <name>               Name of collection to create"
+    echo ""
+    echo "  -c <configset>          Name of configuration directory to use, valid options are:"
+    echo "      basic_configs: Minimal Solr configuration"
+    echo "      data_driven_schema_configs: Managed schema with field-guessing support enabled"
+    echo "      sample_techproducts_configs: Example configuration with many optional features enabled to"
+    echo "         demonstrate the full power of Solr"
+    echo "      If not specified, default is: data_driven_schema_configs"
+    echo ""
+    echo "  -shards <#>             Number of shards to split the collection into"
+    echo ""
+    echo "  -replicationFactor <#>  Number of copies of each document in the collection"
+    echo ""
+    echo ""
   fi
 } # end print_usage
 
@@ -428,6 +458,123 @@ if [ "$SCRIPT_CMD" == "healthcheck" ]; t
   exit $?
 fi
 
+# create a core or collection
+if [[ "$SCRIPT_CMD" == "create_core" || "$SCRIPT_CMD" == "create_collection" ]]; then
+
+  CREATE_TYPE=collection
+  CREATE_NUM_SHARDS=1
+  CREATE_REPFACT=1
+  if [ "$SCRIPT_CMD" == "create_core" ]; then
+    CREATE_TYPE=core
+  fi
+
+  if [ $# -gt 0 ]; then
+    while true; do
+      case $1 in
+          -n|-name)
+              if [ "${2:0:1}" == "-" ]; then
+                print_usage "$SCRIPT_CMD" "Expected $CREATE_TYPE name but found $2 instead!"
+                exit 1
+              fi
+              CREATE_NAME=$2
+              shift 2
+          ;;
+          -c|-configset)
+              if [ "${2:0:1}" == "-" ]; then
+                print_usage "$SCRIPT_CMD" "Expected configset name but found $2 instead!"
+                exit 1
+              fi
+              CREATE_CONFIGSET="$2"
+              shift 2
+          ;;
+          -shards)
+              if [ "${2:0:1}" == "-" ]; then
+                print_usage "$SCRIPT_CMD" "Expected shard count but found $2 instead!"
+                exit 1
+              fi
+              CREATE_NUM_SHARDS="$2"
+              shift 2
+          ;;
+          -replicationFactor)
+              if [ "${2:0:1}" == "-" ]; then
+                print_usage "$SCRIPT_CMD" "Expected replication factor but found $2 instead!"
+                exit 1
+              fi
+              CREATE_REPFACT="$2"
+              shift 2
+          ;;
+          -help|-usage)
+              print_usage "$SCRIPT_CMD"
+              exit 0
+          ;;
+          --)
+              shift
+              break
+          ;;
+          *)
+              if [ "$1" != "" ]; then
+                print_usage "$SCRIPT_CMD" "Unrecognized or misplaced argument: $1!"
+                exit 1
+              else
+                break # out-of-args, stop looping
+              fi
+          ;;
+      esac
+    done
+  fi
+
+  if [ "$CREATE_CONFIGSET" == "" ]; then
+    CREATE_CONFIGSET=data_driven_schema_configs
+  fi
+
+  if [ "$CREATE_NAME" == "" ]; then
+    echo "$CREATE_TYPE name is required!"
+    print_usage "$SCRIPT_CMD"
+    exit 1
+  fi
+
+  for ID in `ps waux | grep java | grep start.jar | awk '{print $2}' | sort -r`
+    do
+      port=`jetty_port "$ID"`
+      if [ "$port" != "" ]; then
+        CREATE_PORT=$port
+        break
+      fi
+  done
+
+  if [ "$CREATE_PORT" == "" ]; then
+    echo "Failed to determine the port of a local Solr instance, cannot create $CREATE_TYPE!"
+    exit 1
+  fi
+
+  STATUS_INFO=`run_tool status -solr http://localhost:$CREATE_PORT/solr | tr -d ' '`
+  IS_CLOUD=`echo $STATUS_INFO | grep $'"cloud":' | tr -d ' '`
+  echo $IS_CLOUD
+  if [ "$IS_CLOUD" != "" ]; then
+    if [ "$SCRIPT_CMD" == "create_core" ]; then
+      echo -e "\nERROR: Solr running on port $CREATE_PORT is running in SolrCloud mode, please use create_collection command instead.\n"
+      exit 1
+    fi
+  else
+    if [ "$SCRIPT_CMD" == "create_collection" ]; then
+      echo -e "\nERROR: Solr running on port $CREATE_PORT is running in standalone server mode, please use the create_core command instead\ncreate_collection can only be used when running in SolrCloud mode.\n"
+      exit 1
+    fi
+  fi
+
+  if [ "$SCRIPT_CMD" == "create_collection" ]; then
+    run_tool create_collection -name $CREATE_NAME -shards $CREATE_NUM_SHARDS -replicationFactor $CREATE_REPFACT \
+      -config $CREATE_CONFIGSET -configsetsDir $SOLR_TIP/server/solr/configsets -solrUrl http://localhost:$CREATE_PORT/solr
+  else
+    CREATE_URL="http://localhost:$CREATE_PORT/solr/admin/cores?action=CREATE&name=$CREATE_NAME&configSet=$CREATE_CONFIGSET"
+    echo -e "Creating new core using command:\n$CREATE_URL\n"
+    run_tool api -get $CREATE_URL
+  fi
+
+  exit $?
+fi
+
+
 # verify the command given is supported
 if [ "$SCRIPT_CMD" != "stop" ] && [ "$SCRIPT_CMD" != "start" ] && [ "$SCRIPT_CMD" != "restart" ]; then
   print_usage "" "$SCRIPT_CMD not supported!"
@@ -652,8 +799,9 @@ if [ "$EXAMPLE" != "" ]; then
             SOLR_PORT=${CLOUD_PORTS[0]}
             shift
         ;;
-        default)
-            SOLR_HOME="$SOLR_TIP/example/solr"
+        techproducts)
+            SOLR_HOME="$SOLR_TIP/server/solr"
+            EXAMPLE_CONFIGSET=sample_techproducts_configs
             shift
         ;;
         dih)
@@ -661,15 +809,12 @@ if [ "$EXAMPLE" != "" ]; then
             shift
         ;;
         schemaless)
-            SOLR_HOME="$SOLR_TIP/example/example-schemaless/solr"
-            shift
-        ;;
-        multicore)
-            SOLR_HOME="$SOLR_TIP/example/multicore"
+            SOLR_HOME="$SOLR_TIP/server/solr"
+            EXAMPLE_CONFIGSET=data_driven_schema_configs
             shift
         ;;
         *)
-            print_usage "start" "Unsupported example $EXAMPLE! Please choose one of: cloud, dih, schemaless, multicore, or default"
+            print_usage "start" "Unsupported example $EXAMPLE! Please choose one of: cloud, dih, schemaless, or techproducts"
             exit 1
         ;;
     esac
@@ -920,6 +1065,25 @@ $SOLR_HOST_ARG -Djetty.port=$SOLR_PORT \
 
 if [ "$EXAMPLE" != "cloud" ]; then
   launch_solr "$FG" "$ADDITIONAL_CMD_OPTS"
+
+  # create the core/collection for the requested example after launching Solr
+  if [[ "$EXAMPLE" == "schemaless" || "$EXAMPLE" == "techproducts" ]]; then
+    if [ "$SOLR_MODE" == "solrcloud" ]; then
+      run_tool create_collection -name $EXAMPLE -shards 1 -replicationFactor 1 \
+        -config $EXAMPLE_CONFIGSET -configsetsDir $SOLR_TIP/server/solr/configsets -solrUrl http://localhost:$SOLR_PORT/solr
+    else
+      CREATE_URL="http://localhost:$SOLR_PORT/solr/admin/cores?action=CREATE&name=$EXAMPLE&configSet=$EXAMPLE_CONFIGSET"
+      echo -e "Creating new core using command:\n$CREATE_URL\n"
+      run_tool api -get $CREATE_URL
+    fi
+
+    if [ "$EXAMPLE" == "techproducts" ]; then
+      echo "Indexing tech product example docs from $SOLR_TIP/example/exampledocs"
+      "$JAVA" -Durl=http://localhost:$SOLR_PORT/solr/$EXAMPLE/update -jar $SOLR_TIP/example/exampledocs/post.jar $SOLR_TIP/example/exampledocs/*.xml
+    fi
+
+    echo -e "\nSolr $EXAMPLE launched successfully. Direct your Web browser to http://localhost:$SOLR_PORT/solr to visit the Solr Admin UI\n"
+  fi
 else
   #
   # SolrCloud example is a bit involved so needs special handling here
@@ -946,8 +1110,6 @@ else
   # can't launch this node in the foreground else we can't run anymore commands
   launch_solr "false" "$ADDITIONAL_CMD_OPTS"
 
-  sleep 5
-
   # if user did not define a specific -z parameter, assume embedded in first cloud node we launched above
   zk_host=$ZK_HOST
   if [ "$zk_host" == "" ]; then
@@ -971,16 +1133,7 @@ else
   if $noprompt ; then
     CLOUD_NUM_SHARDS=2
     CLOUD_REPFACT=2
-    # if the new default config directory is available, then use it, 
-    # otherwise, use the legacy collection1 example
-    # TODO: this will need to change when SOLR-3619 is resolved
-    if [ -d "$SOLR_TIP/server/solr/configsets/schemaless" ]; then
-      CLOUD_CONFIG_DIR=$SOLR_TIP/server/solr/configsets/schemaless
-      CLOUD_CONFIG=schemaless
-    else
-      CLOUD_CONFIG_DIR=$SOLR_TIP/example/solr/collection1/conf
-      CLOUD_CONFIG=default
-    fi        
+    CLOUD_CONFIG=data_driven_schema_configs
   else
     echo -e "\nNow let's create a new collection for indexing documents in your $CLOUD_NUM_NODES-node cluster.\n"
     read -e -p "Please provide a name for your new collection: [gettingstarted] " USER_INPUT
@@ -1014,49 +1167,20 @@ else
       CLOUD_REPFACT=2
     fi                    
     echo $CLOUD_REPFACT
-    
+
     USER_INPUT=
-    read -e -p "Please choose a configuration for the $CLOUD_COLLECTION collection, available options are: default or schemaless [default] " USER_INPUT
+    read -e -p "Please choose a configuration for the $CLOUD_COLLECTION collection, available options are:\nbasic_configs, data_driven_schema_configs, or sample_techproducts_configs [data_driven_schema_configs] " USER_INPUT
     # trim whitespace out of the user input
     CLOUD_CONFIG=`echo $USER_INPUT | tr -d ' '`
 
     # handle the default selection or empty input
     if [ "$CLOUD_CONFIG" == "" ]; then
-      CLOUD_CONFIG=default
+      CLOUD_CONFIG=data_driven_schema_configs
     fi                    
-    echo $CLOUD_CONFIG
-    
-    if [ "$CLOUD_CONFIG" == "schemaless" ]; then
-      if [ -d "$SOLR_TIP/server/solr/configsets/schemaless" ]; then
-        CLOUD_CONFIG_DIR=$SOLR_TIP/server/solr/configsets/schemaless
-      else
-        CLOUD_CONFIG_DIR=$SOLR_TIP/example/example-schemaless/solr/collection1/conf
-      fi        
-    else
-      CLOUD_CONFIG_DIR=$SOLR_TIP/example/solr/collection1/conf
-    fi    
   fi
    
-  echo -e "\nDeploying default Solr configuration files to embedded ZooKeeper using command:\n" 
-  echo -e "$DEFAULT_SERVER_DIR/scripts/cloud-scripts/zkcli.sh -zkhost $zk_host -cmd upconfig -confdir $CLOUD_CONFIG_DIR -confname $CLOUD_CONFIG\n"
-  # upload the config directory to ZooKeeper
-  # Extract the solr.war if it hasn't been done already (so we can access the SolrCLI class)
-  if [ ! -d "$DEFAULT_SERVER_DIR/solr-webapp/webapp" ]; then
-    (mkdir -p $DEFAULT_SERVER_DIR/solr-webapp/webapp && cd $DEFAULT_SERVER_DIR/solr-webapp/webapp && jar xf $DEFAULT_SERVER_DIR/webapps/solr.war)    
-  fi
-  $JAVA -Dlog4j.configuration=file:$DEFAULT_SERVER_DIR/scripts/cloud-scripts/log4j.properties \
-    -classpath "$DEFAULT_SERVER_DIR/solr-webapp/webapp/WEB-INF/lib/*:$DEFAULT_SERVER_DIR/lib/ext/*" \
-    org.apache.solr.cloud.ZkCLI -zkhost $zk_host -cmd upconfig -confdir $CLOUD_CONFIG_DIR -confname $CLOUD_CONFIG > /dev/null 2>&1
-  echo -e "Successfully deployed the $CLOUD_CONFIG_DIR configuration directory to ZooKeeper as $CLOUD_CONFIG\n"
-
-  # note use of ceiling logic in case of remainder
-  MAX_SHARDS_PER_NODE=$((($CLOUD_NUM_SHARDS*$CLOUD_REPFACT+$CLOUD_NUM_NODES-1)/$CLOUD_NUM_NODES))
-  
-  COLLECTIONS_API=http://localhost:$SOLR_PORT/solr/admin/collections
-  
-  CLOUD_CREATE_COLLECTION_CMD="$COLLECTIONS_API?action=CREATE&name=$CLOUD_COLLECTION&replicationFactor=$CLOUD_REPFACT&numShards=$CLOUD_NUM_SHARDS&collection.configName=$CLOUD_CONFIG&maxShardsPerNode=$MAX_SHARDS_PER_NODE&wt=json&indent=2"
-  echo -e "\n\nCreating new collection $CLOUD_COLLECTION with $CLOUD_NUM_SHARDS shards and replication factor $CLOUD_REPFACT using Collections API command:\n\n$CLOUD_CREATE_COLLECTION_CMD\n\nFor more information about the Collections API, please see: https://cwiki.apache.org/confluence/display/solr/Collections+API\n"
-  curl "$CLOUD_CREATE_COLLECTION_CMD"    
+  run_tool create_collection -name $CLOUD_COLLECTION -shards $CLOUD_NUM_SHARDS -replicationFactor $CLOUD_REPFACT \
+    -config $CLOUD_CONFIG -configsetsDir $SOLR_TIP/server/solr/configsets -solrUrl http://localhost:$SOLR_PORT/solr
   echo -e "\n\nSolrCloud example running, please visit http://localhost:$SOLR_PORT/solr \n\n"
 fi
 

Modified: lucene/dev/branches/branch_5x/solr/bin/solr.cmd
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/bin/solr.cmd?rev=1635969&r1=1635968&r2=1635969&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/bin/solr.cmd (original)
+++ lucene/dev/branches/branch_5x/solr/bin/solr.cmd Sat Nov  1 15:21:32 2014
@@ -68,9 +68,20 @@ IF "%1"=="stop" goto set_script_cmd
 IF "%1"=="restart" goto set_script_cmd
 IF "%1"=="healthcheck" (
   REM healthcheck uses different arg parsing strategy
+  set SCRIPT_CMD=healthcheck
   SHIFT
   goto parse_healthcheck_args
 )
+IF "%1"=="create_core" (
+  set SCRIPT_CMD=create_core
+  SHIFT
+  goto parse_create_args
+)
+IF "%1"=="create_collection" (
+  set SCRIPT_CMD=create_collection
+  SHIFT
+  goto parse_create_args
+)
 goto parse_args
 
 :usage
@@ -82,12 +93,15 @@ IF "%FIRST_ARG%"=="/?" goto script_usage
 IF "%SCRIPT_CMD%"=="start" goto start_usage
 IF "%SCRIPT_CMD%"=="restart" goto start_usage
 IF "%SCRIPT_CMD%"=="stop" goto stop_usage
+IF "%SCRIPT_CMD%"=="healthcheck" goto healthcheck_usage
+IF "%SCRIPT_CMD%"=="create_core" goto create_core_usage
+IF "%SCRIPT_CMD%"=="create_collection" goto create_collection_usage
 goto done
 
 :script_usage
 @echo.
 @echo Usage: solr COMMAND OPTIONS
-@echo        where COMMAND is one of: start, stop, restart, healthcheck
+@echo        where COMMAND is one of: start, stop, restart, healthcheck, create_core, create_collection
 @echo.
 @echo   Standalone server example (start Solr running in the background on port 8984):
 @echo.
@@ -133,10 +147,9 @@ goto done
 @echo.
 @echo   -e example    Name of the example to run; available examples:
 @echo       cloud:          SolrCloud example
-@echo       default:        Solr default example
+@echo       techproducts:   Comprehensive example illustrating many of Solr's core capabilities
 @echo       dih:            Data Import Handler
 @echo       schemaless:     Schema-less example
-@echo       multicore:      Multicore
 @echo.
 @echo   -a opts       Additional parameters to pass to the JVM when starting Solr, such as to setup
 @echo                 Java debug options. For example, to enable a Java debugger to attach to the Solr JVM
@@ -157,9 +170,9 @@ goto done
 @echo.
 @echo  -p port     Specify the port to start the Solr HTTP listener on; default is 8983
 @echo.
-@echo  -V          Verbose messages from this script
+@echo  -all        Find and stop all running Solr servers on this host
 @echo.
-@echo NOTE: If port is not specified, then all running Solr servers are stopped.
+@echo  -V          Verbose messages from this script
 @echo.
 goto done
 
@@ -173,6 +186,40 @@ goto done
 @echo.
 goto done
 
+:create_core_usage
+echo.
+echo Usage: solr create_core [-n name] [-c configset]
+echo.
+echo   -n name       Name of core to create
+echo.
+echo   -c configset  Name of configuration directory to use, valid options are:
+echo       basic_configs: Minimal Solr configuration
+echo       data_driven_schema_configs: Managed schema with field-guessing support enabled
+echo       sample_techproducts_configs: Example configuration with many optional features enabled to
+echo          demonstrate the full power of Solr
+echo       If not specified, default is: data_driven_schema_configs
+echo.
+goto done
+
+:create_collection_usage
+echo.
+echo Usage: solr create_collection [-n name] [-c configset] [-shards #] [-replicationFactor #]
+echo.
+echo   -n name               Name of collection to create
+echo.
+echo   -c configset          Name of configuration directory to use, valid options are:
+echo       basic_configs: Minimal Solr configuration
+echo       data_driven_schema_configs: Managed schema with field-guessing support enabled
+echo       sample_techproducts_configs: Example configuration with many optional features enabled to
+echo          demonstrate the full power of Solr
+echo       If not specified, default is: data_driven_schema_configs
+echo.
+echo   -shards #             Number of shards to split the collection into
+echo.
+echo   -replicationFactor #  Number of copies of each document in the collection
+echo.
+goto done
+
 REM Really basic command-line arg parsing
 :parse_args
 IF "%SCRIPT_CMD%"=="" set SCRIPT_CMD=start
@@ -205,6 +252,7 @@ IF "%1"=="-addlopts" goto set_addl_opts
 IF "%1"=="-noprompt" goto set_noprompt
 IF "%1"=="-k" goto set_stop_key
 IF "%1"=="-key" goto set_stop_key
+IF "%1"=="-all" goto set_stop_all
 IF NOT "%1"=="" goto invalid_cmd_line
 
 :set_script_cmd
@@ -320,12 +368,16 @@ IF "%firstChar%"=="-" (
   set SCRIPT_ERROR=Expected port but found %2 instead!
   goto invalid_cmd_line
 )
-
 set STOP_KEY=%~2
 SHIFT
 SHIFT
 goto parse_args
 
+:set_stop_all
+set STOP_ALL=1
+SHIFT
+goto parse_args
+
 :set_zookeeper
 
 set "arg=%~2"
@@ -377,17 +429,15 @@ IF NOT EXIST "%SOLR_SERVER_DIR%" (
 
 IF "%EXAMPLE%"=="" (
   REM SOLR_HOME just becomes serverDir/solr
-) ELSE IF "%EXAMPLE%"=="default" (
-  set "SOLR_HOME=%SOLR_TIP%\example\solr"
+) ELSE IF "%EXAMPLE%"=="techproducts" (
+  set "SOLR_HOME=%SOLR_TIP%\server\solr"
 ) ELSE IF "%EXAMPLE%"=="cloud" (
   set SOLR_MODE=solrcloud
   goto cloud_example_start
 ) ELSE IF "%EXAMPLE%"=="dih" (
   set "SOLR_HOME=%SOLR_TIP%\example\example-DIH\solr"
 ) ELSE IF "%EXAMPLE%"=="schemaless" (
-  set "SOLR_HOME=%SOLR_TIP%\example\example-schemaless\solr"
-) ELSE IF "%EXAMPLE%"=="multicore" (
-  set "SOLR_HOME=%SOLR_TIP%\example\multicore"
+  set "SOLR_HOME=%SOLR_TIP%\server\solr"
 ) ELSE (
   @echo.
   @echo 'Unrecognized example %EXAMPLE%!'
@@ -413,17 +463,62 @@ IF NOT EXIST "%SOLR_HOME%\solr.xml" (
 
 IF "%STOP_KEY%"=="" set STOP_KEY=solrrocks
 
-REM TODO stop all if no port specified as Windows doesn't seem to have a
-REM tool that does: ps waux | grep start.jar
+@REM stop logic here
 IF "%SCRIPT_CMD%"=="stop" (
   IF "%SOLR_PORT%"=="" (
-    set SCRIPT_ERROR=Must specify the port when trying to stop Solr!
-    goto err
+    IF "%STOP_ALL%"=="1" (
+      for /f "usebackq" %%i in (`dir /b %SOLR_TIP\bin% ^| findstr /i "^solr-.*\.port$"`) do (
+        set SOME_SOLR_PORT=
+        For /F "Delims=" %%J In (%SOLR_TIP%\bin\%%i) do set SOME_SOLR_PORT=%%~J
+        if NOT "!SOME_SOLR_PORT!"=="" (
+          for /f "tokens=2,5" %%j in ('netstat -aon ^| find /i "listening" ^| find ":!SOME_SOLR_PORT!"') do (
+            @echo Stopping Solr running on port !SOME_SOLR_PORT!
+            set /A STOP_PORT=!SOME_SOLR_PORT! - 1000
+            "%JAVA%" -jar "%SOLR_SERVER_DIR%\start.jar" STOP.PORT=!STOP_PORT! STOP.KEY=%STOP_KEY% --stop
+            del %SOLR_TIP%\bin\solr-!SOME_SOLR_PORT!.port
+            timeout /T 5
+            REM Kill it if it is still running after the graceful shutdown
+            For /f "tokens=5" %%M in ('netstat -nao ^| find /i "listening" ^| find ":!SOME_SOLR_PORT!"') do (taskkill /f /PID %%M)
+          )
+        )
+      )
+    ) ELSE (
+      set SCRIPT_ERROR=Must specify the port when trying to stop Solr, or use -all to stop all running nodes on this host.
+      goto err
+    )
+  ) ELSE (
+    set found_it=0
+    For /f "tokens=5" %%M in ('netstat -nao ^| find /i "listening" ^| find ":%SOLR_PORT%"') do (
+      set found_it=1
+      @echo Stopping Solr running on port %SOLR_PORT%
+      set /A STOP_PORT=%SOLR_PORT% - 1000
+      "%JAVA%" -jar "%SOLR_SERVER_DIR%\start.jar" STOP.PORT=!STOP_PORT! STOP.KEY=%STOP_KEY% --stop
+      del %SOLR_TIP%\bin\solr-%SOLR_PORT%.port
+      timeout /T 5
+      REM Kill it if it is still running after the graceful shutdown
+      For /f "tokens=5" %%j in ('netstat -nao ^| find /i "listening" ^| find ":%SOLR_PORT%"') do (taskkill /f /PID %%j)
+
+      REM backup log files (use current timestamp for backup name)
+      For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
+      For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set mytime=%%a%%b)
+      set now_ts=!mydate!_!mytime!
+      IF EXIST "%SOLR_SERVER_DIR%\logs\solr.log" (
+        echo Backing up %SOLR_SERVER_DIR%\logs\solr.log
+        move /Y "%SOLR_SERVER_DIR%\logs\solr.log" "%SOLR_SERVER_DIR%\logs\solr_log_!now_ts!"
+      )
+
+      IF EXIST "%SOLR_SERVER_DIR%\logs\solr_gc.log" (
+        echo Backing up %SOLR_SERVER_DIR%\logs\solr_gc.log
+        move /Y "%SOLR_SERVER_DIR%\logs\solr_gc.log" "%SOLR_SERVER_DIR%\logs\solr_gc_log_!now_ts!"
+      )
+    )
+    if "!found_it!"=="0" echo No Solr found running on port %SOLR_PORT%
   )
+  goto done
 )
 
 IF "%SOLR_PORT%"=="" set SOLR_PORT=8983
-IF "%STOP_PORT%"=="" set STOP_PORT=79%SOLR_PORT:~-2,2%
+IF "%STOP_PORT%"=="" set /A STOP_PORT=%SOLR_PORT% - 1000
 
 IF "%SCRIPT_CMD%"=="start" (
   REM see if Solr is already running using netstat
@@ -431,31 +526,8 @@ IF "%SCRIPT_CMD%"=="start" (
     set "SCRIPT_ERROR=Process %%j is already listening on port %SOLR_PORT%. If this is Solr, please stop it first before starting (or use restart). If this is not Solr, then please choose a different port using -p PORT"
     goto err
   )
-) ELSE (
-  @echo Stopping Solr running on port %SOLR_PORT%
-  "%JAVA%" -jar "%SOLR_SERVER_DIR%\start.jar" STOP.PORT=%STOP_PORT% STOP.KEY=%STOP_KEY% --stop
-  timeout /T 5
 )
 
-REM Kill it if it is still running after the graceful shutdown
-For /f "tokens=5" %%j in ('netstat -nao ^| find /i "listening" ^| find ":%SOLR_PORT%"') do (taskkill /f /PID %%j)
-
-REM backup log files (use current timestamp for backup name)
-For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b)
-For /f "tokens=1-2 delims=/:" %%a in ("%TIME%") do (set mytime=%%a%%b)
-set now_ts=%mydate%_%mytime%
-IF EXIST "%SOLR_SERVER_DIR%\logs\solr.log" (
-  echo Backing up %SOLR_SERVER_DIR%\logs\solr.log
-  move /Y "%SOLR_SERVER_DIR%\logs\solr.log" "%SOLR_SERVER_DIR%\logs\solr_log_!now_ts!"
-)
-
-IF EXIST "%SOLR_SERVER_DIR%\logs\solr_gc.log" (
-  echo Backing up %SOLR_SERVER_DIR%\logs\solr_gc.log
-  move /Y "%SOLR_SERVER_DIR%\logs\solr_gc.log" "%SOLR_SERVER_DIR%\logs\solr_gc_log_!now_ts!"
-)
-
-IF "%SCRIPT_CMD%"=="stop" goto done
-
 REM if verbose gc logging enabled, setup the location of the log file
 IF NOT "%GC_LOG_OPTS%"=="" set GC_LOG_OPTS=%GC_LOG_OPTS% -Xloggc:"%SOLR_SERVER_DIR%/logs/solr_gc.log"
 
@@ -521,13 +593,55 @@ cd "%SOLR_SERVER_DIR%"
 @echo.
 IF "%FG%"=="1" (
   REM run solr in the foreground
-  "%JAVA%" -server -Xss256k %SOLR_JAVA_MEM% %START_OPTS% -DSTOP.PORT=%STOP_PORT% -DSTOP.KEY=%STOP_KEY% ^
+  title "Solr-%SOLR_PORT%"
+  echo %SOLR_PORT%>%SOLR_TIP%\bin\solr-%SOLR_PORT%.port
+  "%JAVA%" -server -Xss256k %SOLR_JAVA_MEM% %START_OPTS% -DSTOP.PORT=!STOP_PORT! -DSTOP.KEY=%STOP_KEY% ^
     -Djetty.port=%SOLR_PORT% -Dsolr.solr.home="%SOLR_HOME%" -Dsolr.install.dir="%SOLR_TIP%" -jar start.jar
 ) ELSE (
-  START "" "%JAVA%" -server -Xss256k %SOLR_JAVA_MEM% %START_OPTS% -DSTOP.PORT=%STOP_PORT% -DSTOP.KEY=%STOP_KEY% ^
+  START "Solr-%SOLR_PORT%" "%JAVA%" -server -Xss256k %SOLR_JAVA_MEM% %START_OPTS% -DSTOP.PORT=!STOP_PORT! -DSTOP.KEY=%STOP_KEY% ^
     -Djetty.port=%SOLR_PORT% -Dsolr.solr.home="%SOLR_HOME%" -Dsolr.install.dir="%SOLR_TIP%" -jar start.jar > "%SOLR_SERVER_DIR%\logs\solr-%SOLR_PORT%-console.log"
+  echo %SOLR_PORT%>%SOLR_TIP%\bin\solr-%SOLR_PORT%.port
 )
 
+
+set CREATE_EXAMPLE_CONFIG=
+IF "%EXAMPLE%"=="schemaless" (
+  set CREATE_EXAMPLE_CONFIG=data_driven_schema_configs
+)
+IF "%EXAMPLE%"=="techproducts" (
+  set CREATE_EXAMPLE_CONFIG=sample_techproducts_configs
+)
+
+IF NOT "!CREATE_EXAMPLE_CONFIG!"=="" (
+  timeout /T 5
+  IF "%SOLR_MODE%"=="solrcloud" (
+    "%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
+      -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
+      org.apache.solr.util.SolrCLI create_collection -name !EXAMPLE! -shards 1 -replicationFactor 1 ^
+      -config !CREATE_EXAMPLE_CONFIG! -configsetsDir "%SOLR_SERVER_DIR%\solr\configsets" -solrUrl http://localhost:%SOLR_PORT%/solr
+  ) ELSE (
+    set "CREATE_URL=http://localhost:%SOLR_PORT%/solr/admin/cores?action=CREATE&name=%EXAMPLE%&configSet=!CREATE_EXAMPLE_CONFIG!"
+    @echo.
+    @echo Creating new core using command:
+    @echo !CREATE_URL!
+    @echo.
+    "%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
+      -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
+      org.apache.solr.util.SolrCLI api -get "!CREATE_URL!"
+  )
+)
+
+IF "%EXAMPLE%"=="techproducts" (
+  @echo.
+  @echo Indexing tech product example docs from %SOLR_TIP%\example\exampledocs
+  "%JAVA%" -Durl=http://localhost:%SOLR_PORT%/solr/%EXAMPLE%/update -jar %SOLR_TIP%/example/exampledocs/post.jar %SOLR_TIP%/example/exampledocs/*.xml
+)
+
+@echo.
+@echo Solr %EXAMPLE% launched successfully.
+@echo Direct your Web browser to http://localhost:%SOLR_PORT%/solr to visit the Solr Admin UI
+@echo.
+
 goto done
 
 :cloud_example_start
@@ -608,8 +722,9 @@ for /l %%x in (1, 1, !CLOUD_NUM_NODES!) 
     )
     @echo Starting node1 on port !NODE_PORT! using command:
     @echo solr -cloud -p !NODE_PORT! -d node1 !DASHZ! !DASHM!
-    START "" "%SDIR%\solr" -f -cloud -p !NODE_PORT! -d node1 !DASHZ! !DASHM!
+    START "Solr-!NODE_PORT!" "%SDIR%\solr" -f -cloud -p !NODE_PORT! -d node1 !DASHZ! !DASHM!
     set NODE1_PORT=!NODE_PORT!
+    echo !NODE_PORT!>%SOLR_TIP%\bin\solr-!NODE_PORT!.port
   ) ELSE (
     IF "!ZK_HOST!"=="" (
       set /A ZK_PORT=!NODE1_PORT!+1000
@@ -617,7 +732,8 @@ for /l %%x in (1, 1, !CLOUD_NUM_NODES!) 
     )
     @echo Starting node%%x on port !NODE_PORT! using command:
     @echo solr -cloud -p !NODE_PORT! -d node%%x -z !ZK_HOST! !DASHM!
-    START "" "%SDIR%\solr" -f -cloud -p !NODE_PORT! -d node%%x -z !ZK_HOST! !DASHM!
+    START "Solr-!NODE_PORT!" "%SDIR%\solr" -f -cloud -p !NODE_PORT! -d node%%x -z !ZK_HOST! !DASHM!
+    echo !NODE_PORT!>%SOLR_TIP%\bin\solr-!NODE_PORT!.port
   )
 
   timeout /T 10
@@ -630,8 +746,7 @@ IF "%NO_USER_PROMPT%"=="1" (
   set CLOUD_COLLECTION=gettingstarted
   set CLOUD_NUM_SHARDS=2
   set CLOUD_REPFACT=2
-  set CLOUD_CONFIG=default
-  set "CLOUD_CONFIG_DIR=%SOLR_TIP%\example\solr\collection1\conf"
+  set CLOUD_CONFIG=data_driven_schema_configs
   goto create_collection
 ) ELSE (
   goto get_create_collection_params
@@ -656,43 +771,17 @@ set CLOUD_REPFACT=!USER_INPUT!
 echo !CLOUD_REPFACT!
 set USER_INPUT=
 echo.
-set /P "USER_INPUT=Please choose a configuration for the !CLOUD_COLLECTION! collection, available options are: default or schemaless [default] "
-IF "!USER_INPUT!"=="" set USER_INPUT=default
+set /P "USER_INPUT=Please choose a configuration for the !CLOUD_COLLECTION! collection, available options are: basic_configs, data_driven_schema_configs, or sample_techproducts_configs [data_driven_schema_configs]"
+IF "!USER_INPUT!"=="" set USER_INPUT=data_driven_schema_configs
 set CLOUD_CONFIG=!USER_INPUT!
 echo !CLOUD_CONFIG!
-
-IF "!CLOUD_CONFIG!"=="schemaless" (
-  IF EXIST "%SOLR_TIP%\server\solr\configsets\schemaless" set "CLOUD_CONFIG_DIR=%SOLR_TIP%\server\solr\configsets\schemaless"
-  IF NOT EXIST "%SOLR_TIP%\server\solr\configsets\schemaless" set "CLOUD_CONFIG_DIR=%SOLR_TIP%\example\example-schemaless\solr\collection1\conf"
-) ELSE (
-  set "CLOUD_CONFIG_DIR=%SOLR_TIP%\example\solr\collection1\conf"
-)
-
 goto create_collection
 
 :create_collection
-set /A MAX_SHARDS_PER_NODE=((!CLOUD_NUM_SHARDS!*!CLOUD_REPFACT!)/!CLOUD_NUM_NODES!)+1
-
-echo.
-echo Deploying default Solr configuration files to embedded ZooKeeper
-echo.
 "%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
   -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
-  org.apache.solr.cloud.ZkCLI -zkhost %zk_host% -cmd upconfig -confdir "!CLOUD_CONFIG_DIR!" -confname !CLOUD_CONFIG!
-
-set COLLECTIONS_API=http://localhost:!NODE1_PORT!/solr/admin/collections
-
-set "CLOUD_CREATE_COLLECTION_CMD=%COLLECTIONS_API%?action=CREATE&name=%CLOUD_COLLECTION%&replicationFactor=%CLOUD_REPFACT%&numShards=%CLOUD_NUM_SHARDS%&collection.configName=!CLOUD_CONFIG!&maxShardsPerNode=%MAX_SHARDS_PER_NODE%&wt=json&indent=2"
-echo Creating new collection %CLOUD_COLLECTION% with %CLOUD_NUM_SHARDS% shards and replication factor %CLOUD_REPFACT% using Collections API command:
-echo.
-@echo "%CLOUD_CREATE_COLLECTION_CMD%"
-echo.
-echo For more information about the Collections API, please see: https://cwiki.apache.org/confluence/display/solr/Collections+API
-echo.
-
-"%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
-  -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
-  org.apache.solr.util.SolrCLI api -get "%CLOUD_CREATE_COLLECTION_CMD%"
+  org.apache.solr.util.SolrCLI create_collection -name !CLOUD_COLLECTION! -shards !CLOUD_NUM_SHARDS! -replicationFactor !CLOUD_REPFACT! ^
+  -config !CLOUD_CONFIG! -configsetsDir "%SOLR_SERVER_DIR%\solr\configsets" -zkHost %zk_host%
 
 echo.
 echo SolrCloud example is running, please visit http://localhost:%NODE1_PORT%/solr"
@@ -705,20 +794,19 @@ goto done
 :get_info
 REM Find all Java processes, correlate with those listening on a port
 REM and then try to contact via that port using the status tool
-for /f "tokens=2" %%a in ('tasklist ^| find "java.exe"') do (
-  for /f "tokens=2,5" %%j in ('netstat -aon ^| find /i "listening"') do (
-    if "%%k" EQU "%%a" (
+for /f "usebackq" %%i in (`dir /b %SOLR_TIP\bin% ^| findstr /i "^solr-.*\.port$"`) do (
+  set SOME_SOLR_PORT=
+  For /F "Delims=" %%J In (%SOLR_TIP%\bin\%%i) do set SOME_SOLR_PORT=%%~J
+  if NOT "!SOME_SOLR_PORT!"=="" (
+    for /f "tokens=2,5" %%j in ('netstat -aon ^| find /i "listening" ^| find /i "!SOME_SOLR_PORT!"') do (
       for /f "delims=: tokens=1,2" %%x IN ("%%j") do (
-        if "0.0.0.0" EQU "%%x" (
-          @echo.
-          set has_info=1
-          echo Found Solr process %%k running on port %%y
-          "%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
-            -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
-            org.apache.solr.util.SolrCLI status -solr http://localhost:%%y/solr
-
-          @echo.
-        )
+        @echo.
+        set has_info=1
+        echo Found Solr process %%k running on port !SOME_SOLR_PORT!
+        "%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
+          -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
+          org.apache.solr.util.SolrCLI status -solr http://localhost:!SOME_SOLR_PORT!/solr
+        @echo.
       )
     )
   )
@@ -758,6 +846,111 @@ IF NOT DEFINED HEALTHCHECK_ZK_HOST set "
   org.apache.solr.util.SolrCLI healthcheck -collection !HEALTHCHECK_COLLECTION! -zkHost !HEALTHCHECK_ZK_HOST!
 goto done
 
+:parse_create_args
+IF [%1]==[] goto run_create
+IF "%1"=="-c" goto set_create_config
+IF "%1"=="-configset" goto set_create_config
+IF "%1"=="-n" goto set_create_name
+IF "%1"=="-name" goto set_create_name
+IF "%1"=="-shards" goto set_create_shards
+IF "%1"=="-replicationFactor" goto set_create_rf
+IF "%1"=="-help" goto usage
+IF "%1"=="-usage" goto usage
+IF "%1"=="/?" goto usage
+goto run_create
+
+:set_create_configset
+set CREATE_CONFIGSET=%~2
+SHIFT
+SHIFT
+goto parse_create_args
+
+:set_create_name
+set CREATE_NAME=%~2
+SHIFT
+SHIFT
+goto parse_create_args
+
+:set_create_shards
+set CREATE_NUM_SHARDS=%~2
+SHIFT
+SHIFT
+goto parse_create_args
+
+:set_create_rf
+set CREATE_REPFACT=%~2
+SHIFT
+SHIFT
+goto parse_create_args
+
+:run_create
+IF "!CREATE_NAME!"=="" (
+  set "SCRIPT_ERROR=Name (-n) is a required parameter for $SCRIPT_CMD"
+  goto invalid_cmd_line
+)
+IF "!CREATE_CONFIGSET!"=="" set CREATE_CONFIGSET=data_driven_schema_configs
+IF "!CREATE_NUM_SHARDS!"=="" set CREATE_NUM_SHARDS=1
+IF "!CREATE_REPFACT!"=="" set CREATE_REPFACT=1
+
+REM Find a port that Solr is running on
+set CREATE_PORT=0
+for /f "usebackq" %%i in (`dir /b %SOLR_TIP\bin% ^| findstr /i "^solr-.*\.port$"`) do (
+  set SOME_SOLR_PORT=
+  For /F "Delims=" %%J In (%SOLR_TIP%\bin\%%i) do set SOME_SOLR_PORT=%%~J
+  if NOT "!SOME_SOLR_PORT!"=="" (
+    for /f "tokens=2,5" %%j in ('netstat -aon ^| find /i "listening" ^| find /i "!SOME_SOLR_PORT!"') do (
+      set CREATE_PORT=!SOME_SOLR_PORT!
+    )
+  )
+)
+if "!CREATE_PORT!" EQU "0" (
+  set "SCRIPT_ERROR=Could not find a running Solr instance on this host!"
+  goto err
+)
+
+@echo Found Solr node running on port !CREATE_PORT!
+
+@REM Determine if the Solr node is in cloud or standalone server mode
+"%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
+  -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
+  org.apache.solr.util.SolrCLI status -solr http://localhost:!CREATE_PORT!/solr > solr_status.txt
+set /p VAR=<solr_status.txt
+del solr_status.txt
+if "!VAR!"=="!VAR:ZooKeeper=!" (
+  @REM Not in CloudMode - create core
+  if "%SCRIPT_CMD%"=="create_core" (
+    set "CREATE_URL=http://localhost:!CREATE_PORT!/solr/admin/cores?action=CREATE&name=!CREATE_NAME!&configSet=!CREATE_CONFIGSET!"
+    @echo.
+    @echo Creating new core using command:
+    @echo !CREATE_URL!
+    @echo.
+    "%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
+      -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
+      org.apache.solr.util.SolrCLI api -get "!CREATE_URL!"
+  ) else (
+    @echo.
+    @echo ERROR: Solr running on port !CREATE_PORT! is running in standalone server mode, please use the create_core command instead.
+    @echo %SCRIPT_CMD% can only be used when running in SolrCloud mode.
+    @echo.
+    goto done
+  )
+) ELSE (
+  @REM In CloudMode - create collection
+  if "%SCRIPT_CMD%"=="create_collection" (
+    "%JAVA%" -Dlog4j.configuration="file:%DEFAULT_SERVER_DIR%\scripts\cloud-scripts\log4j.properties" ^
+      -classpath "%DEFAULT_SERVER_DIR%\solr-webapp\webapp\WEB-INF\lib\*;%DEFAULT_SERVER_DIR%\lib\ext\*" ^
+      org.apache.solr.util.SolrCLI create_collection -name !CREATE_NAME! -shards !CREATE_NUM_SHARDS! -replicationFactor !CREATE_REPFACT! ^
+      -config !CREATE_CONFIGSET! -configsetsDir "%SOLR_TIP%\server\solr\configsets" -solrUrl http://localhost:!CREATE_PORT!/solr
+  ) else (
+    @echo.
+    @echo ERROR: Solr running on port !CREATE_PORT! is running in SolrCloud mode, please use the create_collection command instead.
+    @echo %SCRIPT_CMD% can only be used when running in standalone server mode.
+    @echo.
+    goto done
+  )
+)
+goto done
+
 :invalid_cmd_line
 @echo.
 IF "!SCRIPT_ERROR!"=="" (
@@ -776,6 +969,10 @@ IF "%FIRST_ARG%"=="start" (
   goto stop_usage
 ) ELSE IF "%FIRST_ARG%"=="healthcheck" (
   goto healthcheck_usage
+) ELSE IF "%FIRST_ARG%"=="create_core" (
+  goto create_core_usage
+) ELSE IF "%FIRST_ARG%"=="create_collection" (
+  goto create_collection_usage
 ) ELSE (
   goto script_usage
 )

Modified: lucene/dev/branches/branch_5x/solr/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/build.xml?rev=1635969&r1=1635968&r2=1635969&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/build.xml (original)
+++ lucene/dev/branches/branch_5x/solr/build.xml Sat Nov  1 15:21:32 2014
@@ -42,7 +42,7 @@
   <target name="example" description="Creates a runnable example configuration."
           depends="dist-contrib,dist-war">
     <copy file="${dist}/${fullnamever}.war"
-          tofile="${example}/webapps/${ant.project.name}.war"/>
+          tofile="${server.dir}/webapps/${ant.project.name}.war"/>
     <jar destfile="${example}/exampledocs/post.jar"
          basedir="${dest}/solr-core/classes/java"
          includes="org/apache/solr/util/SimplePostTool*.class">
@@ -51,7 +51,7 @@
       </manifest>
     </jar>
     <delete includeemptydirs="true">
-      <fileset dir="${example}/solr-webapp" includes="**/*"/>
+      <fileset dir="${server.dir}/solr-webapp" includes="**/*"/>
     </delete>
     <echo>See ${example}/README.txt for how to run the Solr example configuration.</echo>
   </target>
@@ -66,7 +66,7 @@
     </condition>
     <property name="example.jvm.line" value=""/>
     <property name="example.heap.size" value="512M"/>
-    <java jar="${example}/start.jar" fork="true" dir="${example}" maxmemory="${example.heap.size}">
+    <java jar="${server.dir}/start.jar" fork="true" dir="${server.dir}" maxmemory="${example.heap.size}">
       <jvmarg line="${example.jvm.line}"/>
       <sysproperty key="solr.solr.home" file="${example.solr.home}"/>
       <sysproperty key="jetty.port" value="${example.jetty.port}"/>
@@ -254,9 +254,9 @@
     <license-check-macro dir="${basedir}" licensedir="${common-solr.dir}/licenses">
       <additional-excludes>
         <!-- Exclude start.jar only (it'd be weird to have a license file there?) -->
-        <exclude name="example/start.jar" />
+        <exclude name="server/start.jar" />
         <exclude name="example/exampledocs/post.jar" />
-        <exclude name="example/solr-webapp/**" />
+        <exclude name="server/solr-webapp/**" />
         <exclude name="package/**"/>
       </additional-excludes>
       <additional-filters>
@@ -295,14 +295,22 @@
     <delete dir="build" />
     <delete dir="dist" />
     <delete dir="package" />
+    <delete dir="server/solr/lib" />
     <delete dir="example/solr/lib" />
     <delete includeemptydirs="true">
       <fileset dir="example">
         <include name="**/data/**/*" />
+        <exclude name="**/.gitignore" />
+      </fileset>
+      <fileset dir="server">
+        <include name="**/data/**/*" />
+        <include name="solr/zoo_data" />
+        <include name="start.jar" />
+        <include name="logs/*" />
         <include name="webapps/**/*" />
         <include name="solr-webapp/**/*" />
         <exclude name="**/.gitignore" />
-      </fileset>
+      </fileset>    	
     </delete>
   </target>
   
@@ -416,7 +424,7 @@
       <tarfileset dir="." prefix="${fullnamever}" includes="LICENSE.txt NOTICE.txt"/>
       <tarfileset dir="." prefix="${fullnamever}/solr"
                   excludes="build/** ${package.dir.rel}/** ${dist.rel}/**
-                            example/webapps/*.war example/lib/**
+                            server/webapps/*.war example/lib/**
                             **/*.jar 
                             lib/README.committers.txt **/data/ **/logs/*
                             **/*.sh **/bin/ scripts/ 
@@ -443,7 +451,7 @@
     </antcall>
     <mkdir dir="${dest}/${fullnamever}"/>
     <delete includeemptydirs="true">
-      <fileset dir="${example}/solr-webapp" includes="**/*"/>
+      <fileset dir="${server.dir}/solr-webapp" includes="**/*"/>
       <fileset dir="${dest}/${fullnamever}" includes="**/*"/>
     </delete>
  
@@ -461,7 +469,7 @@
       <tarfileset dir="."
                   prefix="${fullnamever}"
                   includes="LICENSE.txt NOTICE.txt CHANGES.txt README.txt SYSTEM_REQUIREMENTS.txt
-                            example/** contrib/**/lib/** contrib/**/README.txt 
+                            bin/** server/** example/** contrib/**/lib/** contrib/**/README.txt 
                             licenses/**"
                   excludes="licenses/README.committers.txt **/data/ **/logs/* 
                             **/classes/ **/*.sh **/ivy.xml **/build.xml
@@ -473,7 +481,7 @@
       <tarfileset dir="."
                   filemode="755"
                   prefix="${fullnamever}"
-                  includes="bin/* example/**/*.sh example/**/bin/" />
+                  includes="bin/* server/**/*.sh example/**/*.sh example/**/bin/" />
       <tarfileset dir="."
                   prefix="${fullnamever}"
                   includes="dist/*.jar dist/*.war 
@@ -527,7 +535,7 @@
     <sign-artifacts-macro artifacts.dir="${package.dir}"/>
   </target>
  
-  <target name="resolve" depends="resolve-example">
+  <target name="resolve" depends="resolve-example,resolve-server">
      <sequential>
      <ant dir="core" target="resolve" inheritall="false">
          <propertyset refid="uptodate.and.compiled.properties"/>

Modified: lucene/dev/branches/branch_5x/solr/common-build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/common-build.xml?rev=1635969&r1=1635968&r2=1635969&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/common-build.xml (original)
+++ lucene/dev/branches/branch_5x/solr/common-build.xml Sat Nov  1 15:21:32 2014
@@ -37,6 +37,7 @@
   <property name="maven.dist.dir" location="${package.dir}/maven"/>
   <property name="lucene-libs" location="${dest}/lucene-libs" />
   <property name="tests.userdir" location="src/test-files"/>
+  <property name="server.dir" location="${common-solr.dir}/server" />
   <property name="example" location="${common-solr.dir}/example" />
   <property name="javadoc.dir" location="${dest}/docs"/>
   <property name="tests.cleanthreads.sysprop" value="perClass"/>
@@ -70,7 +71,7 @@
   <path id="additional.dependencies">
   	<fileset dir="${common-solr.dir}/core/lib" excludes="${common.classpath.excludes}"/>
   	<fileset dir="${common-solr.dir}/solrj/lib" excludes="${common.classpath.excludes}"/>
-  	<fileset dir="${common-solr.dir}/example/lib" excludes="${common.classpath.excludes}"/>
+  	<fileset dir="${common-solr.dir}/server/lib" excludes="${common.classpath.excludes}"/>
   	<fileset dir="${common-solr.dir}/example/example-DIH/solr/db/lib" excludes="${common.classpath.excludes}"/>  	
   	<fileset dir="lib" excludes="${common.classpath.excludes}" erroronmissingdir="false"/>
   </path>
@@ -224,7 +225,7 @@
     <solr-jarify/>
   </target>
 
-  <target name="compile-core" depends="prep-lucene-jars,resolve-example,common.compile-core"/>
+  <target name="compile-core" depends="prep-lucene-jars,resolve-example,resolve-server,common.compile-core"/>
   <target name="compile-test" depends="compile-solr-test-framework,common.compile-test"/>
 
   <target name="dist" depends="jar-core">
@@ -424,15 +425,20 @@
 
   <!-- resolve dependencies in the example (relied upon by compile/tests) -->
   <target name="resolve-example" unless="example.libs.uptodate">
-    <ant dir="${common-solr.dir}/example" target="resolve" inheritAll="false">
-      <propertyset refid="uptodate.and.compiled.properties"/>
-    </ant>
     <ant dir="${common-solr.dir}/example/example-DIH" target="resolve" inheritAll="false">
       <propertyset refid="uptodate.and.compiled.properties"/>
     </ant>
     <property name="example.libs.uptodate" value="true"/>
   </target>
 
+  <!-- resolve dependencies in the server directory (relied upon by compile/tests) -->
+  <target name="resolve-server" unless="server.libs.uptodate">
+    <ant dir="${common-solr.dir}/server" target="resolve" inheritAll="false">
+      <propertyset refid="uptodate.and.compiled.properties"/>
+    </ant>
+    <property name="server.libs.uptodate" value="true"/>
+  </target>
+
   <macrodef name="contrib-crawl">
     <attribute name="target" default=""/>
     <attribute name="failonerror" default="true"/>

Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/util/SolrCLI.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/util/SolrCLI.java?rev=1635969&r1=1635968&r2=1635969&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/util/SolrCLI.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/util/SolrCLI.java Sat Nov  1 15:21:32 2014
@@ -17,6 +17,9 @@ 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;
@@ -40,12 +43,19 @@ import org.apache.commons.cli.Option;
 import org.apache.commons.cli.OptionBuilder;
 import org.apache.commons.cli.Options;
 import org.apache.commons.cli.ParseException;
+import org.apache.http.HttpEntity;
+import org.apache.http.HttpResponse;
 import org.apache.http.NoHttpResponseException;
+import org.apache.http.StatusLine;
+import org.apache.http.client.ClientProtocolException;
 import org.apache.http.client.HttpClient;
+import org.apache.http.client.HttpResponseException;
+import org.apache.http.client.ResponseHandler;
 import org.apache.http.client.methods.HttpGet;
 import org.apache.http.client.utils.URIBuilder;
 import org.apache.http.conn.ConnectTimeoutException;
 import org.apache.http.impl.client.BasicResponseHandler;
+import org.apache.http.util.EntityUtils;
 import org.apache.log4j.Level;
 import org.apache.log4j.LogManager;
 import org.apache.log4j.Logger;
@@ -55,6 +65,7 @@ import org.apache.solr.client.solrj.impl
 import org.apache.solr.client.solrj.impl.HttpClientUtil;
 import org.apache.solr.client.solrj.impl.HttpSolrServer;
 import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.cloud.ZkController;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.cloud.ClusterState;
 import org.apache.solr.common.cloud.Replica;
@@ -191,7 +202,9 @@ public class SolrCLI {
       return new StatusTool();
     else if ("api".equals(toolType))
       return new ApiTool();
-    
+    else if ("create_collection".equals(toolType))
+      return new CreateCollectionTool();
+
     // If you add a built-in tool to this class, add it here to avoid
     // classpath scanning
 
@@ -209,7 +222,8 @@ public class SolrCLI {
     formatter.printHelp("healthcheck", getToolOptions(new HealthcheckTool()));
     formatter.printHelp("status", getToolOptions(new StatusTool()));
     formatter.printHelp("api", getToolOptions(new ApiTool()));
-    
+    formatter.printHelp("create_collection", getToolOptions(new CreateCollectionTool()));
+
     List<Class<Tool>> toolClasses = findToolClassesInPackage("org.apache.solr.util");
     for (Class<Tool> next : toolClasses) {
       Tool tool = next.newInstance();
@@ -416,6 +430,23 @@ public class SolrCLI {
     
     return json;
   }
+
+  private static class SolrResponseHandler implements ResponseHandler<Map<String,Object>> {
+    public Map<String,Object> handleResponse(HttpResponse response) throws ClientProtocolException, IOException {
+      HttpEntity entity = response.getEntity();
+      if (entity != null) {
+        Object resp = ObjectBuilder.getVal(new JSONParser(EntityUtils.toString(entity)));
+        if (resp != null && resp instanceof Map) {
+          return (Map<String,Object>)resp;
+        } else {
+          throw new ClientProtocolException("Expected JSON object in response but received "+ resp);
+        }
+      } else {
+        StatusLine statusLine = response.getStatusLine();
+        throw new HttpResponseException(statusLine.getStatusCode(), statusLine.getReasonPhrase());
+      }
+    }
+  }
   
   /**
    * Utility function for sending HTTP GET request to Solr and then doing some
@@ -423,35 +454,21 @@ public class SolrCLI {
    */
   @SuppressWarnings({"unchecked"})
   public static Map<String,Object> getJson(HttpClient httpClient, String getUrl) throws Exception {
-    Map<String,Object> json = null;
-       
     // ensure we're requesting JSON back from Solr
     HttpGet httpGet = new HttpGet(new URIBuilder(getUrl).setParameter("wt", "json").build());
-
-    //Will throw HttpResponseException if a non-ok response
-    String content = httpClient.execute(httpGet, new BasicResponseHandler());
-    
-    Object resp = ObjectBuilder.getVal(new JSONParser(content));
-    if (resp != null && resp instanceof Map) {
-      json = (Map<String,Object>)resp;
-    } else {
-      throw new SolrServerException("Expected JSON object in response from "+
-          getUrl+" but received "+ resp);
-    }
-    
-    // lastly check the response JSON from Solr to see if it is an error
+    // make the request and get back a parsed JSON object
+    Map<String,Object> json = httpClient.execute(httpGet, new SolrResponseHandler());
+    // check the response JSON from Solr to see if it is an error
     Long statusCode = asLong("/responseHeader/status", json);
-    
     if (statusCode == -1) {
       throw new SolrServerException("Unable to determine outcome of GET request to: "+
           getUrl+"! Response: "+json);
     } else if (statusCode != 0) {
       String errMsg = asString("/error/msg", json);
-      
-      errMsg = errMsg == null ? String.valueOf(json) : errMsg;
+      if (errMsg == null)
+        errMsg = String.valueOf(json);
       throw new SolrServerException("Request to "+getUrl+" failed due to: "+errMsg);
     }
-
     return json;
   }  
 
@@ -566,40 +583,40 @@ public class SolrCLI {
       String solrUrl = cli.getOptionValue("solr", DEFAULT_SOLR_URL);
       if (!solrUrl.endsWith("/"))
         solrUrl += "/";
-      
+
       int exitCode = 0;
       String systemInfoUrl = solrUrl+"admin/info/system";
       HttpClient httpClient = getHttpClient();
-      try {        
+      try {
         // hit Solr to get system info
         Map<String,Object> systemInfo = getJson(httpClient, systemInfoUrl, 2);
-        
+
         // convert raw JSON into user-friendly output
-        Map<String,Object> status = 
+        Map<String,Object> status =
             reportStatus(solrUrl, systemInfo, httpClient);
-        
+
         // pretty-print the status to stdout
         CharArr arr = new CharArr();
         new JSONWriter(arr, 2).write(status);
         System.out.println(arr.toString());
-        
+
       } catch (Exception exc) {
         if (checkCommunicationError(exc)) {
           // this is not actually an error from the tool as it's ok if Solr is not online.
           System.err.println("Solr at "+solrUrl+" not online.");
         } else {
           System.err.print("Failed to get system information from "+solrUrl+" due to: ");
-          exc.printStackTrace(System.err);          
+          exc.printStackTrace(System.err);
           exitCode = 1;
         }
       } finally {
-        closeHttpClient(httpClient);        
+        closeHttpClient(httpClient);
       }
-            
+
       return exitCode;
-    }    
+    }
     
-    protected Map<String,Object> reportStatus(String solrUrl, Map<String,Object> info, HttpClient httpClient) 
+    public Map<String,Object> reportStatus(String solrUrl, Map<String,Object> info, HttpClient httpClient)
         throws Exception
     {
       Map<String,Object> status = new LinkedHashMap<String,Object>();
@@ -614,26 +631,7 @@ public class SolrCLI {
       
       // if this is a Solr in solrcloud mode, gather some basic cluster info
       if ("solrcloud".equals(info.get("mode"))) {
-        
-        // TODO: Need a better way to get the zkHost from a running server
-        // as it can be set from solr.xml vs. on the command-line
-        String zkHost = null;
-        List<String> args = asList("/jvm/jmx/commandLineArgs", info);
-        if (args != null) {
-          for (String arg : args) {
-            if (arg.startsWith("-DzkHost=")) {
-              zkHost = arg.substring("-DzkHost=".length());
-              break;
-            } else if (arg.startsWith("-DzkRun")) {
-              URL serverUrl = new URL(solrUrl);
-              String host = serverUrl.getHost();
-              int port = serverUrl.getPort();
-              zkHost = host+":"+(port+1000)+" (embedded)";
-              break;
-            }
-          }
-        }
-        
+        String zkHost = (String)info.get("zkHost");
         status.put("cloud", getCloudStatus(httpClient, solrUrl, zkHost));
       }
       
@@ -703,6 +701,195 @@ public class SolrCLI {
     }    
   } // end ApiTool class
 
+  /**
+   * Supports create_collection command in the bin/solr script.
+   */
+  public static class CreateCollectionTool implements Tool {
+
+    private static final String DEFAULT_CONFIG_SET = "data_driven_schema_configs";
+
+    @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)
+            throw new IllegalArgumentException("Solr server at "+solrUrl+" not running in SolrCloud mode!");
+
+          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&configSet=%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());
+    }
+
+    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;

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/TestZkChroot.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/TestZkChroot.java?rev=1635969&r1=1635968&r2=1635969&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/TestZkChroot.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/TestZkChroot.java Sat Nov  1 15:21:32 2014
@@ -19,6 +19,7 @@ package org.apache.solr.cloud;
 
 import java.io.File;
 
+import org.apache.solr.SolrJettyTestBase;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.cloud.SolrZkClient;
 import org.apache.solr.common.cloud.ZooKeeperException;
@@ -46,7 +47,7 @@ public class TestZkChroot extends SolrTe
     zkDir = createTempDir("zkData").toFile().getAbsolutePath();
     zkServer = new ZkTestServer(zkDir);
     zkServer.run();
-    home = ExternalPaths.EXAMPLE_HOME;
+    home = SolrJettyTestBase.legacyExampleCollection1SolrHome();
     
   }
   

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java?rev=1635969&r1=1635968&r2=1635969&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ZkCLITest.java Sat Nov  1 15:21:32 2014
@@ -29,6 +29,7 @@ import org.apache.commons.io.FileUtils;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.io.filefilter.RegexFileFilter;
 import org.apache.commons.io.filefilter.TrueFileFilter;
+import org.apache.solr.SolrJettyTestBase;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.SolrException;
 import org.apache.solr.common.cloud.SolrZkClient;
@@ -75,14 +76,16 @@ public class ZkCLITest extends SolrTestC
   public void setUp() throws Exception {
     super.setUp();
     log.info("####SETUP_START " + getTestName());
+
+    String exampleHome = SolrJettyTestBase.legacyExampleCollection1SolrHome();
     
     boolean useNewSolrXml = random().nextBoolean();
     File tmpDir = createTempDir().toFile();
     if (useNewSolrXml) {
-      solrHome = ExternalPaths.EXAMPLE_HOME;
+      solrHome = exampleHome;
     } else {
       File tmpSolrHome = new File(tmpDir, "tmp-solr-home");
-      FileUtils.copyDirectory(new File(ExternalPaths.EXAMPLE_HOME), tmpSolrHome);
+      FileUtils.copyDirectory(new File(exampleHome), tmpSolrHome);
       FileUtils.copyFile(getFile("old-solr-example/solr.xml"), new File(tmpSolrHome, "solr.xml"));
       solrHome = tmpSolrHome.getAbsolutePath();
     }
@@ -214,8 +217,7 @@ public class ZkCLITest extends SolrTestC
         "-cmd",
         "upconfig",
         "-confdir",
-        ExternalPaths.EXAMPLE_HOME + File.separator + "collection1"
-            + File.separator + "conf", "-confname", confsetname};
+        ExternalPaths.TECHPRODUCTS_CONFIGSET, "-confname", confsetname};
     ZkCLI.main(args);
     
     assertTrue(zkClient.exists(ZkController.CONFIGS_ZKNODE + "/" + confsetname, true));
@@ -245,13 +247,12 @@ public class ZkCLITest extends SolrTestC
     List<String> zkFiles = zkClient.getChildren(ZkController.CONFIGS_ZKNODE + "/" + confsetname, null, true);
     assertEquals(files.length, zkFiles.size());
     
-    File sourceConfDir = new File(ExternalPaths.EXAMPLE_HOME + File.separator + "collection1"
-            + File.separator + "conf");
+    File sourceConfDir = new File(ExternalPaths.TECHPRODUCTS_CONFIGSET);
     // filter out all directories starting with . (e.g. .svn)
     Collection<File> sourceFiles = FileUtils.listFiles(sourceConfDir, TrueFileFilter.INSTANCE, new RegexFileFilter("[^\\.].*"));
     for (File sourceFile :sourceFiles){
-        int indexOfRelativePath = sourceFile.getAbsolutePath().lastIndexOf("collection1" + File.separator + "conf");
-        String relativePathofFile = sourceFile.getAbsolutePath().substring(indexOfRelativePath + 17, sourceFile.getAbsolutePath().length());
+        int indexOfRelativePath = sourceFile.getAbsolutePath().lastIndexOf("sample_techproducts_configs" + File.separator + "conf");
+        String relativePathofFile = sourceFile.getAbsolutePath().substring(indexOfRelativePath + 33, sourceFile.getAbsolutePath().length());
         File downloadedFile = new File(confDir,relativePathofFile);
         assertTrue(downloadedFile.getAbsolutePath() + " does not exist source:" + sourceFile.getAbsolutePath(), downloadedFile.exists());
         assertTrue("Content didn't change",FileUtils.contentEquals(sourceFile,downloadedFile));

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java?rev=1635969&r1=1635968&r2=1635969&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/cloud/ZkControllerTest.java Sat Nov  1 15:21:32 2014
@@ -24,6 +24,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.lucene.util.LuceneTestCase.Slow;
+import org.apache.solr.SolrJettyTestBase;
 import org.apache.solr.SolrTestCaseJ4;
 import org.apache.solr.common.cloud.SolrZkClient;
 import org.apache.solr.common.cloud.ZkNodeProps;
@@ -232,11 +233,13 @@ public class ZkControllerTest extends So
             }
           });
 
-      zkController.uploadToZK(new File(ExternalPaths.EXAMPLE_HOME + "/collection1/conf"),
+      String solrHome = SolrJettyTestBase.legacyExampleCollection1SolrHome();
+
+      zkController.uploadToZK(new File(solrHome + "/collection1/conf"),
           ZkController.CONFIGS_ZKNODE + "/config1");
       
       // uploading again should overwrite, not error...
-      zkController.uploadToZK(new File(ExternalPaths.EXAMPLE_HOME + "/collection1/conf"),
+      zkController.uploadToZK(new File(solrHome + "/collection1/conf"),
           ZkController.CONFIGS_ZKNODE + "/config1");
 
       if (DEBUG) {

Modified: lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java?rev=1635969&r1=1635968&r2=1635969&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/test/org/apache/solr/handler/admin/ShowFileRequestHandlerTest.java Sat Nov  1 15:21:32 2014
@@ -43,7 +43,7 @@ public class ShowFileRequestHandlerTest 
 
   @BeforeClass
   public static void beforeTest() throws Exception {
-    createJetty(ExternalPaths.EXAMPLE_HOME, null, null);
+    createJetty(legacyExampleCollection1SolrHome(), null, null);
   }
 
   public void test404ViaHttp() throws SolrServerException {

Modified: lucene/dev/branches/branch_5x/solr/example/README.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/example/README.txt?rev=1635969&r1=1635968&r2=1635969&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/example/README.txt (original)
+++ lucene/dev/branches/branch_5x/solr/example/README.txt Sat Nov  1 15:21:32 2014
@@ -16,14 +16,25 @@
 Solr example
 ------------
 
-This directory contains an instance of the Jetty Servlet container setup to 
-run Solr using an example configuration.
+This directory contains Solr examples. Each example is contained in a 
+separate directory. To run a specific example, do:
 
-To run this example:
+  bin/solr -e <EXAMPLE> where <EXAMPLE> is one of:
+  
+    cloud        : SolrCloud example
+    dih          : Data Import Handler (rdbms, mail, rss, tika)
+    schemaless   : Schema-less example (schema is inferred from data during indexing)
+    techproducts : Kitchen sink example providing comprehensive examples of Solr features
 
-  java -jar start.jar
+For instance, if you want to run the Solr Data Import Handler example, do:
 
-in this example directory, and when Solr is started connect to 
+  bin/solr -e dih
+  
+To see all the options available when starting Solr:
+
+  bin/solr start -help
+
+After starting a Solr example, direct your Web browser to:
 
   http://localhost:8983/solr/
 
@@ -46,16 +57,6 @@ For more information about this example 
 Notes About These Examples
 --------------------------
 
-* SolrHome *
-
-By default, start.jar starts Solr in Jetty using the default Solr Home
-directory of "./solr/" (relative to the working directory of hte servlet 
-container).  To run other example configurations, you can specify the 
-solr.solr.home system property when starting jetty...
-
-  java -Dsolr.solr.home=multicore -jar start.jar
-  java -Dsolr.solr.home=example-DIH/solr -jar start.jar
-
 * References to Jar Files Outside This Directory *
 
 Various example SolrHome dirs contained in this directory may use "<lib>"

Modified: lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleBinaryTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleBinaryTest.java?rev=1635969&r1=1635968&r2=1635969&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleBinaryTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleBinaryTest.java Sat Nov  1 15:21:32 2014
@@ -35,7 +35,7 @@ import org.junit.BeforeClass;
 public class SolrExampleBinaryTest extends SolrExampleTests {
   @BeforeClass
   public static void beforeTest() throws Exception {
-    createJetty(ExternalPaths.EXAMPLE_HOME, null, null);
+    createJetty(legacyExampleCollection1SolrHome(), null, null);
   }
 
   @Override

Modified: lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleXMLTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleXMLTest.java?rev=1635969&r1=1635968&r2=1635969&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleXMLTest.java (original)
+++ lucene/dev/branches/branch_5x/solr/solrj/src/test/org/apache/solr/client/solrj/SolrExampleXMLTest.java Sat Nov  1 15:21:32 2014
@@ -32,7 +32,7 @@ import org.junit.BeforeClass;
 public class SolrExampleXMLTest extends SolrExampleTests {
   @BeforeClass
   public static void beforeTest() throws Exception {
-    createJetty(ExternalPaths.EXAMPLE_HOME, null, null);
+    createJetty(legacyExampleCollection1SolrHome(), null, null);
   }
   
   @Override



Mime
View raw message