You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by eh...@apache.org on 2015/01/15 01:55:06 UTC
svn commit: r1651917 - in /lucene/dev/branches/branch_5x: ./ solr/ solr/bin/
solr/core/ solr/core/src/java/org/apache/solr/util/ solr/example/
solr/example/films/ solr/site/
Author: ehatcher
Date: Thu Jan 15 00:55:05 2015
New Revision: 1651917
URL: http://svn.apache.org/r1651917
Log:
SOLR-6900: converted to Unix-style options in bin/post and updated usage examples, also updated version string of SimplePostTool (merged from trunk r1651916)
Modified:
lucene/dev/branches/branch_5x/ (props changed)
lucene/dev/branches/branch_5x/solr/ (props changed)
lucene/dev/branches/branch_5x/solr/bin/ (props changed)
lucene/dev/branches/branch_5x/solr/bin/post
lucene/dev/branches/branch_5x/solr/core/ (props changed)
lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/util/SimplePostTool.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/example/films/README.txt
lucene/dev/branches/branch_5x/solr/site/ (props changed)
lucene/dev/branches/branch_5x/solr/site/quickstart.mdtext
Modified: lucene/dev/branches/branch_5x/solr/bin/post
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/bin/post?rev=1651917&r1=1651916&r2=1651917&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/bin/post (original)
+++ lucene/dev/branches/branch_5x/solr/bin/post Thu Jan 15 00:55:05 2015
@@ -70,22 +70,22 @@ function print_usage() {
echo "OPTIONS"
echo "======="
echo " Solr options:"
- echo " url=<base Solr update URL> (overrides collection, host, and port)"
- echo " host=<host> (default: localhost)"
- echo " port=<port> (default: 8983)"
- echo " commit=yes|no (default: yes)"
+ echo " -url <base Solr update URL> (overrides collection, host, and port)"
+ echo " -host <host> (default: localhost)"
+ echo " -port <port> (default: 8983)"
+ echo " -commit yes|no (default: yes)"
echo ""
echo " Web crawl options:"
- echo " recursive=<depth> (default: 1)"
- echo " delay=<seconds> (default=10)"
+ echo " -recursive <depth> (default: 1)"
+ echo " -delay <seconds> (default=10)"
echo ""
echo " Directory crawl options:"
- echo " delay=<seconds> (default=0)"
+ echo " -delay <seconds> (default=0)"
echo ""
echo " Other options:"
- echo " filetypes=<type>[,<type>,...] (default: xml,json,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log)"
- echo " params=\"<key>=<value>[&<key>=<value>...]\" (values must be URL-encoded)"
- echo " out=yes|no (default=no; yes outputs Solr response to console)"
+ echo " -filetypes <type>[,<type>,...] (default: xml,json,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log)"
+ echo " -params \"<key>=<value>[&<key>=<value>...]\" (values must be URL-encoded; these pass through to Solr update request)"
+ echo " -out yes|no (default=no; yes outputs Solr response to console)"
echo ""
echo ""
echo "Examples:"
@@ -94,7 +94,7 @@ function print_usage() {
echo "XML files: $THIS_SCRIPT -c records article*.xml"
echo "CSV file: $THIS_SCRIPT -c signals LATEST-signals.csv"
echo "Directory of files: $THIS_SCRIPT -c myfiles ~/Documents"
- echo "Web crawl: $THIS_SCRIPT -c gettingstarted http://lucidworks.com recursive=2 delay=1"
+ echo "Web crawl: $THIS_SCRIPT -c gettingstarted http://lucidworks.com -recursive 2 -delay 1"
echo ""
} # end print_usage
@@ -113,32 +113,38 @@ URLS=()
while [ $# -gt 0 ]; do
# TODO: natively handle the optional parameters to SPT
# but for now they can be specified as bin/post -c collection-name delay=5 http://lucidworks.com
- if [[ "$1" == "-c" ]]; then
- # Pull out collection name
- shift
- COLLECTION=$1
+
+ if [[ -d "$1" ]]; then
+ # Directory
+# echo "$1: DIRECTORY"
+ MODE="files"
+ RECURSIVE="-Drecursive=yes"
+ FILES+=("$1")
+ elif [[ -f "$1" ]]; then
+ # File
+# echo "$1: FILE"
+ MODE="files"
+ FILES+=("$1")
+ elif [[ "$1" == http* ]]; then
+ # URL
+# echo "$1: URL"
+ MODE="web"
+ URLS+=("$1")
else
- # General argument, either a file, directory, URL, or param[=val]
- if [[ -d "$1" ]]; then
- # Directory
-# echo "$1: DIRECTORY"
- MODE="files"
- RECURSIVE="-Drecursive=yes"
- FILES+=("$1")
- elif [[ -f "$1" ]]; then
- # File
-# echo "$1: FILE"
- MODE="files"
- FILES+=("$1")
- elif [[ "$1" == http* ]]; then
- # URL
-# echo "$1: URL"
- MODE="web"
- URLS+=("$1")
+ if [[ $1 == -* ]]; then
+ if [[ $1 == "-c" ]]; then
+ # Special case, pull out collection name
+ shift
+ COLLECTION=$1
+ else
+ key=${1:1}
+ shift
+# echo "$1: PROP"
+ PROPS="$PROPS -D$key=$1"
+ fi
else
- # Not a file, directory or URL. Consider it a property to SPT
-# echo "$1: PROP"
- PROPS="$PROPS -D$1"
+ echo -e "\nUnrecognized argument: $1\n"
+ exit 1
fi
fi
shift
Modified: lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/util/SimplePostTool.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/util/SimplePostTool.java?rev=1651917&r1=1651916&r2=1651917&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/util/SimplePostTool.java (original)
+++ lucene/dev/branches/branch_5x/solr/core/src/java/org/apache/solr/util/SimplePostTool.java Thu Jan 15 00:55:05 2015
@@ -76,7 +76,7 @@ import java.util.zip.InflaterInputStream
public class SimplePostTool {
private static final String DEFAULT_POST_HOST = "localhost";
private static final String DEFAULT_POST_PORT = "8983";
- private static final String VERSION_OF_THIS_TOOL = "1.5";
+ private static final String VERSION_OF_THIS_TOOL = "5.0.0"; // TODO: hardcoded for now, but eventually to sync with actual Solr version
private static final String DEFAULT_COMMIT = "yes";
private static final String DEFAULT_OPTIMIZE = "no";
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=1651917&r1=1651916&r2=1651917&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/example/README.txt (original)
+++ lucene/dev/branches/branch_5x/solr/example/README.txt Thu Jan 15 00:55:05 2015
@@ -41,9 +41,7 @@ After starting a Solr example, direct yo
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 exampledocs
- java -jar post.jar *.xml
-Or: sh post.sh *.xml
+ bin/post -c techproducts example/exampledocs/*.xml
For more information about this example please read...
Modified: lucene/dev/branches/branch_5x/solr/example/films/README.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/example/films/README.txt?rev=1651917&r1=1651916&r2=1651917&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/example/films/README.txt (original)
+++ lucene/dev/branches/branch_5x/solr/example/films/README.txt Thu Jan 15 00:55:05 2015
@@ -15,7 +15,7 @@ This data consists of the following fiel
bin/solr start
* Create a "films" core:
- bin/solr create_core -n films -c data_driven_schema_configs
+ bin/solr create -c films
* Set the schema on a couple of fields that Solr would otherwise guess differently (than we'd like) about:
curl http://localhost:8983/solr/films/schema -X POST -H 'Content-type:application/json' --data-binary '{
@@ -33,12 +33,12 @@ curl http://localhost:8983/solr/films/sc
* Now let's index the data, using one of these three commands:
- - JSON: bin/post films example/films/films.json
- - XML: bin/post films example/films/films.xml
+ - JSON: bin/post -c films example/films/films.json
+ - XML: bin/post -c films example/films/films.xml
- CSV: bin/post \
- films \
+ -c films \
example/films/films.csv \
- "params=f.genre.split=true&f.directed_by.split=true&f.genre.separator=|&f.directed_by.separator=|"
+ -params "f.genre.split=true&f.directed_by.split=true&f.genre.separator=|&f.directed_by.separator=|"
* Let's get searching!
- Search for 'Batman':
@@ -98,7 +98,7 @@ bin/solr stop
rm server/logs/*.log
rm -Rf server/solr/films/
bin/solr start
-bin/solr create_core -n films -c data_driven_schema_configs
+bin/solr create -c films
curl http://localhost:8983/solr/films/schema -X POST -H 'Content-type:application/json' --data-binary '{
"add-field" : {
"name":"name",
@@ -111,7 +111,7 @@ curl http://localhost:8983/solr/films/sc
"stored":true
}
}'
-bin/post films example/films/films.json
+bin/post -c films example/films/films.json
curl http://localhost:8983/solr/films/config/params -H 'Content-type:application/json' -d '{
"update" : {
"facets": {
Modified: lucene/dev/branches/branch_5x/solr/site/quickstart.mdtext
URL: http://svn.apache.org/viewvc/lucene/dev/branches/branch_5x/solr/site/quickstart.mdtext?rev=1651917&r1=1651916&r2=1651917&view=diff
==============================================================================
--- lucene/dev/branches/branch_5x/solr/site/quickstart.mdtext (original)
+++ lucene/dev/branches/branch_5x/solr/site/quickstart.mdtext Thu Jan 15 00:55:05 2015
@@ -76,11 +76,11 @@ many other formats. `SimplePostTool` fe
sending the raw content of each file into Solr for extraction and indexing. A Solr install includes a `docs/`
subdirectory, so that makes a convenient set of (mostly) HTML files built-in to start with.
- bin/post gettingstarted docs/
+ bin/post -c gettingstarted docs/
Here's what it'll look like:
- /solr5:$ bin/post gettingstarted docs/
+ /solr5:$ bin/post -c gettingstarted docs/
SimplePostTool version 1.5
Posting files to base url http://localhost:8983/solr/update..
Entering auto mode. File endings considered are xml,json,csv,pdf,doc,docx,ppt,pptx,xls,xlsx,odt,odp,ods,ott,otp,ots,rtf,htm,html,txt,log
@@ -123,7 +123,7 @@ Solr's install includes a handful of Sol
Using `bin/post`, index the example Solr XML files in `example/exampledocs/`:
- bin/post -c gettingstarted example/exampledocs/*.xml (TODO: depends on SOLR-6900)
+ bin/post -c gettingstarted example/exampledocs/*.xml
Here's what you'll see:
@@ -165,11 +165,11 @@ Solr supports indexing JSON, either arbi
Solr includes a small sample Solr JSON file to illustrate this capability. Again using `bin/post`, index the
sample JSON file:
- bin/post -c gettingstarted example/exampledocs/books.json (TODO: depends on SOLR-6900)
+ bin/post -c gettingstarted example/exampledocs/books.json
You'll see:
- /solr5:$ bin/post -c gettingstarted example/exampledocs/books.json (TODO: depends on SOLR-6900)
+ /solr5:$ bin/post -c gettingstarted example/exampledocs/books.json
SimplePostTool version 1.5
Posting files to base url http://localhost:8983/solr/update..
Entering auto mode. File endings considered are xml,json,csv,...
@@ -190,11 +190,11 @@ index that into Solr rather than a more
Using SimplePostTool and the included example CSV data file, index it:
- bin/post -c gettingstarted example/exampledocs/books.csv (TODO: depends on SOLR-6900)
+ bin/post -c gettingstarted example/exampledocs/books.csv
In your terminal you'll see:
- /solr5:$ bin/post -c gettingstarted example/exampledocs/books.csv (TODO: depends on SOLR-6900)
+ /solr5:$ bin/post -c gettingstarted example/exampledocs/books.csv
SimplePostTool version 1.5
Posting files to base url http://localhost:8983/solr/update..
Entering auto mode. File endings considered are xml,json,csv,...
@@ -562,7 +562,6 @@ on your computer's power and resources a
Here's a Unix script for convenient copying and pasting in order to run the key commands for this quick start guide:
- # TODO: depends on SOLR-6900
date ;
bin/solr start -e cloud -noprompt ;
open http://localhost:8983/solr ;