You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ct...@apache.org on 2017/10/26 20:26:05 UTC

[1/3] lucene-solr:master: Ref Guide: copy edit metrics updates; change param presentation format

Repository: lucene-solr
Updated Branches:
  refs/heads/master c440361a1 -> 7ece47caf


Ref Guide: copy edit metrics updates; change param presentation format


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/f748fc24
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/f748fc24
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/f748fc24

Branch: refs/heads/master
Commit: f748fc24b1c5059e3a77c697ddc937d12f608bce
Parents: be4a084
Author: Cassandra Targett <ct...@apache.org>
Authored: Thu Oct 26 14:57:37 2017 -0500
Committer: Cassandra Targett <ct...@apache.org>
Committed: Thu Oct 26 14:58:08 2017 -0500

----------------------------------------------------------------------
 solr/solr-ref-guide/src/metrics-reporting.adoc | 121 ++++++++++++++------
 1 file changed, 85 insertions(+), 36 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/f748fc24/solr/solr-ref-guide/src/metrics-reporting.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/metrics-reporting.adoc b/solr/solr-ref-guide/src/metrics-reporting.adoc
index 451f93e..f7d173c 100644
--- a/solr/solr-ref-guide/src/metrics-reporting.adoc
+++ b/solr/solr-ref-guide/src/metrics-reporting.adoc
@@ -178,17 +178,30 @@ This example configures two reporters: <<Graphite Reporter,Graphite>> and <<SLF4
 
 Reporter plugins use the following arguments:
 
-* *name* - (required) unique name of the reporter plugin
-* *class* - (required) fully-qualified implementation class of the plugin, must extend `SolrMetricReporter`
-* *group* - (optional) one or more of the predefined groups (see above)
-* *registry* - (optional) one or more of valid fully-qualified registry names
-* If both `group` and `registry` attributes are specified only the `group` attribute is considered. If neither attribute is specified then the plugin will be used for all groups and registries. Multiple group or registry names can be specified, separated by comma and/or space.
+`name`::
+The unique name of the reporter plugin (required).
+
+`class`::
+The fully-qualified implementation class of the plugin, which must extend `SolrMetricReporter` (required).
+
+`group`::
+One or more of the predefined groups (see above).
+
+`registry`::
+One or more of valid fully-qualified registry names.
+
+If both `group` and `registry` attributes are specified only the `group` attribute is considered. If neither attribute is specified then the plugin will be used for all groups and registries. Multiple group or registry names can be specified, separated by comma and/or space.
 
 Additionally, several implementation-specific initialization arguments can be specified in nested elements. There are some arguments that are common to SLF4J, Ganglia and Graphite reporters:
 
-* *period* - (optional int) period in seconds between reports. Default value is 60.
-* *prefix* - (optional str) prefix to be added to metric names, may be helpful in logical grouping of related Solr instances, e.g., machine name or cluster name. Default is empty string, i.e., just the registry name and metric name will be used to form a fully-qualified metric name.
-* *filter* - (optional str) if not empty then only metric names that start with this value will be reported. Default is no filtering, i.e., all metrics from selected registry will be reported.
+`period`::
+The period in seconds between reports. Default value is `60`.
+
+`prefix`::
+A prefix to be added to metric names, which may be helpful in logical grouping of related Solr instances, e.g., machine name or cluster name. Default is empty string, i.e., just the registry name and metric name will be used to form a fully-qualified metric name.
+
+`filter`::
+If not empty then only metric names that start with this value will be reported. Default is no filtering, i.e., all metrics from the selected registry will be reported.
 
 Reporters are instantiated for every group and registry that they were configured for, at the time when the respective components are initialized (e.g., on JVM startup or SolrCore load).
 
@@ -204,9 +217,14 @@ The JMX Reporter uses the `org.apache.solr.metrics.reporters.SolrJmxReporter` cl
 
 It takes the following arguments:
 
-* *domain* - (optional string) JMX domain name. If not specified then the registry name will be used.
-* *serviceUrl* - (optional string) The service URL for a JMX server. If not specified, Solr will attempt to discover if the JVM has an MBean server and will use that address. See below for additional information on this.
-* *agentId* - (optional string) The agent ID for a JMX server. Note either `serviceUrl` or `agentId` can be specified but not both - if both are specified then the default MBean server will be used.
+`domain`::
+The JMX domain name. If not specified then the registry name will be used.
+
+`serviceUrl`::
+The service URL for a JMX server. If not specified, Solr will attempt to discover if the JVM has an MBean server and will use that address. See below for additional information on this.
+
+`agentId`::
+The agent ID for a JMX server. Note either `serviceUrl` or `agentId` can be specified but not both - if both are specified then the default MBean server will be used.
 
 Object names created by this reporter are hierarchical, dot-separated but also properly structured to form corresponding hierarchies in e.g., JConsole. This hierarchy consists of the following elements in the top-down order:
 
@@ -225,7 +243,8 @@ The SLF4J Reporter uses the `org.apache.solr.metrics.reporters.SolrSlf4jReporter
 
 It takes the following arguments, in addition to the common arguments <<Reporter Arguments,above>>.
 
-* *logger* - (optional str) name of the logger to use. Default is empty, in which case the group or registry name will be used if specified in the plugin configuration.
+`logger`::
+The name of the logger to use. Default is empty, in which case the group or registry name will be used if specified in the plugin configuration.
 
 Users can specify logger name (and the corresponding logger configuration in e.g., Log4j configuration) to output metrics-related logging to separate file(s), which can then be processed by external applications.
 
@@ -252,9 +271,13 @@ The http://graphiteapp.org[Graphite] Reporter uses the `org.apache.solr.metrics.
 
 It takes the following attributes, in addition to the common attributes <<Reporter Arguments,above>>.
 
-* *host* - (required str) host name where Graphite server is running.
-* *port* - (required int) port number for the server
-* *pickled* - (optional bool) use "pickled" Graphite protocol which may be more efficient. Default is false (use plain-text protocol).
+`host`::
+The host name where Graphite server is running (required).
+
+`port`::
+The port number for the server (required).
+`pickled`::
+If `true`, use "pickled" Graphite protocol which may be more efficient. Default is `false` (use plain-text protocol).
 
 When plain-text protocol is used (`pickled==false`) it's possible to use this reporter to integrate with systems other than Graphite, if they can accept space-separated and line-oriented input over network in the following format:
 
@@ -282,9 +305,14 @@ The http://ganglia.info[Ganglia] reporter uses the `org.apache.solr.metrics.repo
 
 It take the following arguments, in addition to the common arguments <<Reporter Arguments,above>>.
 
-* *host* - (required str) host name where Ganglia server is running.
-* *port* - (required int) port number for the server
-* *multicast* - (optional bool) when true use multicast UDP communication, otherwise use UDP unicast. Default is false.
+`host`::
+The host name where Ganglia server is running (required).
+
+`port`::
+The port number for the server.
+
+`multicast`::
+When `true` use multicast UDP communication, otherwise use UDP unicast. Default is `false`.
 
 === Shard and Cluster Reporters
 These two reporters can be used for aggregation of metrics reported from replicas to shard leader (the "shard" reporter),
@@ -299,7 +327,7 @@ and re-reported elsewhere as necessary.
 In case of shard reporter the target node is the shard leader, in case of cluster reporter the
 target node is the Overseer leader.
 
-=== Shard Reporter
+==== Shard Reporter
 This reporter uses predefined `shard` group, and the implementing class must be (a subclass of)
 `solr.SolrShardReporter`. It publishes selected metrics from replicas to the node where shard leader is
 located. Reports use a target registry name that is the replica's registry name with a `.leader` suffix, e.g., for a
@@ -308,12 +336,18 @@ SolrCore name `collection1_shard1_replica_n3` the target registry name is
 
 The following configuration properties are supported:
 
-* *handler* - (optional str) handler path where reports are sent. Default is `/admin/metrics/collector`.
-* *period* - (optional int) how often reports are sent, in seconds. Default is 60. Setting this to 0 disables the reporter.
-* *filter* - (optional multiple str) regex expression(s) matching selected metrics to be reported.
+`handler`::
+The handler path where reports are sent. Default is `/admin/metrics/collector`.
+
+`period`::
+How often reports are sent, in seconds. Default is `60`. Setting this to `0` disables the reporter.
 
+`filter`::
+An optional regular expression(s) matching selected metrics to be reported.
++
 The following filter expressions are used by default:
-[source]
++
+[source,text]
 ----
 TLOG.*
 CORE\.fs.*
@@ -334,27 +368,39 @@ Example configuration:
       </reporter>
 ----
 
-=== Cluster Reporter
+==== Cluster Reporter
 This reporter uses predefined `cluster` group and the implementing class must be (a subclass of)
 `solr.SolrClusterReporter`. It publishes selected metrics from any local registry to the Overseer leader node.
 
 The following configuration properties are supported:
 
-* *handler* - (optional str) handler path where reports are sent. Default is `/admin/metrics/collector`.
-* *period* - (optional int) how often reports are sent, in seconds. Default is 60. Setting this to 0 disables the reporter.
-* *report* - (optional multiple lst) report configuration(s), see below.
+`handler`::
+The handler path where reports are sent. Default is `/admin/metrics/collector`.
+
+`period`::
+How often reports are sent, in seconds. Default is `60`. Setting this to `0` disables the reporter.
+
+`report`::
+report configuration(s), see below.
+
+Each report configuration consists of the following properties:
 
-Each report configuration consist of the following properties:
+`registry`::
+A regular expression pattern matching local source registries (see `SolrMetricManager.registryNames(String...)`), may contain regex capture groups (required).
 
-* *registry* - (required str) regex pattern matching local source registries (see `SolrMetricManager.registryNames(String...)`), may contain regex capture groups.
-* *group* - (required str) target registry name where metrics will be grouped. This can be a regex pattern that contains back-references to capture groups collected by registry pattern
-* *label* - (optional str) optional prefix to prepend to metric names, may contain back-references to capture groups collected by registry pattern
-* *filter* - (optional multiple str) regex expression(s) matching selected metrics to be reported.
+`group`::
+The target registry name where metrics will be grouped. This can be a regular expression pattern that contains back-references to capture groups collected by registry pattern (required).
+
+`label`::
+An optional prefix to prepend to metric names, may contain back-references to capture groups collected by registry pattern.
+
+`filter`::
+An optional regular expression(s) matching selected metrics to be reported.
 
 The following report specifications are used by default (their result is a single additional metric registry in Overseer, called
 `solr.cluster`):
 
-[source]
+[source,xml]
 ----
    <lst name="report">
     <str name="group">cluster</str>
@@ -537,12 +583,15 @@ Like other request handlers, the Metrics API can also take the `wt` parameter to
 
 Request only "counter" type metrics in the "core" group, returned in JSON:
 
-`\http://localhost:8983/solr/admin/metrics?type=counter&group=core`
+[source,text]
+http://localhost:8983/solr/admin/metrics?type=counter&group=core
 
 Request only "core" group metrics that start with "INDEX", returned in XML:
 
-`\http://localhost:8983/solr/admin/metrics?wt=xml&prefix=INDEX&group=core`
+[source,text]
+http://localhost:8983/solr/admin/metrics?wt=xml&prefix=INDEX&group=core
 
 Request only "user.name" property of "system.properties" metric from registry "solr.jvm":
 
-`\http://localhost:8983/solr/admin/metrics?wt=xml?key=solr.jvm:system.properties:user.name`
+[source,text]
+http://localhost:8983/solr/admin/metrics?wt=xml?key=solr.jvm:system.properties:user.name


[2/3] lucene-solr:master: SOLR-11509: Upgrade notes for 7.1 Ref Guide

Posted by ct...@apache.org.
SOLR-11509: Upgrade notes for 7.1 Ref Guide


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/be4a0846
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/be4a0846
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/be4a0846

Branch: refs/heads/master
Commit: be4a0846b676fdeb5ef5085d0cddfed39619f89e
Parents: c440361
Author: Cassandra Targett <ct...@apache.org>
Authored: Thu Oct 26 14:56:38 2017 -0500
Committer: Cassandra Targett <ct...@apache.org>
Committed: Thu Oct 26 14:58:08 2017 -0500

----------------------------------------------------------------------
 solr/solr-ref-guide/src/solr-upgrade-notes.adoc | 25 +++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/be4a0846/solr/solr-ref-guide/src/solr-upgrade-notes.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/solr-upgrade-notes.adoc b/solr/solr-ref-guide/src/solr-upgrade-notes.adoc
index 39cec2f..752c1e0 100644
--- a/solr/solr-ref-guide/src/solr-upgrade-notes.adoc
+++ b/solr/solr-ref-guide/src/solr-upgrade-notes.adoc
@@ -27,12 +27,35 @@ When planning your Solr upgrade, consider the customizations you have made to yo
 
 Detailed steps for upgrading a Solr cluster can be found in the section <<upgrading-a-solr-cluster.adoc#upgrading-a-solr-cluster,Upgrading a Solr Cluster>>.
 
+== Upgrading from Solr 7.0
+Users should be aware of the following major changes from v7.0:
+
+* The feature to automatically add replicas if a replica goes down, previously available only when storing indexes in HDFS, has been ported to the autoscaling framework. Due to this, `autoAddReplicas` is now available to all users even if their indexes are on local disks.
++
+Existing users of this feature should not have to change anything. However, they should note these changes:
+
+** Behavior: Changing the `autoAddReplicas` property from disabled (`false`) to enabled (`true`) using <<collections-api.adoc#modifycollection,MODIFYCOLLECTION API>> no longer replaces down replicas for the collection immediately. Instead, replicas are only added if a node containing them went down while `autoAddReplicas` was enabled. The parameters `autoReplicaFailoverBadNodeExpiration` and `autoReplicaFailoverWorkLoopDelay` are no longer used.
+** Deprecations: Enabling/disabling autoAddReplicas cluster-wide with the API will be deprecated; use suspend/resume trigger APIs with `name=".auto_add_replicas"` instead.
++
+More information about the changes to this feature can be found in the section <<solrcloud-autoscaling-auto-add-replicas.adoc#solrcloud-autoscaling-auto-add-replicas,SolrCloud Automatically Adding Replicas>>.
+
+* Shard and cluster metric reporter configuration now require a class attribute.
+** If a reporter configures the `group="shard"` attribute then please also configure the `class="org.apache.solr.metrics.reporters.solr.SolrShardReporter"` attribute.
+** If a reporter configures the `group="cluster"` attribute then please also configure the   `class="org.apache.solr.metrics.reporters.solr.SolrClusterReporter"` attribute.
++
+See the section <<metrics-reporting.adoc#shard-and-cluster-reporters,Shard and Cluster Reporters>> for more information.
+
+* All Stream Evaluators in `solrj.io.eval` have been refactored to have a simpler and more robust structure. This simplifies and condenses the code required to implement a new Evaluator and makes it much easier for evaluators to handle differing data types (primitives, objects, arrays, lists, and so forth).
+* In the ReplicationHandler, the `master.commitReserveDuration` sub-element is deprecated. Instead please configure a direct `commitReserveDuration` element for use in all modes (master, slave, cloud).
+* The `RunExecutableListener` was removed for security reasons. If you want to listen to events caused by updates, commits, or optimize, write your own listener as native Java class as part of a Solr plugin.
+* In the XML query parser (`defType=xmlparser` or `{!xmlparser ... }`) the resolving of external entities is now disallowed by default.
+
 == Upgrading from Any 6.x Release
 
 The upgrade from Solr 6.x to Solr 7 introduces several *major* changes that you should be aware of before upgrading. Please do a thorough review of the section <<major-changes-in-solr-7.adoc#major-changes-in-solr-7,Major Changes in Solr 7>> before starting your upgrade.
 
 == Upgrading from Older Versions of Solr
 
-Users upgrading from older versions are strongly encouraged to consult {solr-javadocs}/changes/Changes.html[`CHANGES.txt`] for the details of _all_ changes since the version they are upgrading from.
+Users upgrading from versions of Solr prior to 6.x are strongly encouraged to consult {solr-javadocs}/changes/Changes.html[`CHANGES.txt`] for the details of _all_ changes since the version they are upgrading from.
 
 A summary of the significant changes between Solr 5.x and Solr 6.0 can be found in the <<major-changes-from-solr-5-to-solr-6.adoc#major-changes-from-solr-5-to-solr-6,Major Changes from Solr 5 to Solr 6>> section.


[3/3] lucene-solr:master: SOLR-11032: Update SolrJ tutorial with new example test for real tested code samples

Posted by ct...@apache.org.
SOLR-11032: Update SolrJ tutorial with new example test for real tested code samples


Project: http://git-wip-us.apache.org/repos/asf/lucene-solr/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucene-solr/commit/7ece47ca
Tree: http://git-wip-us.apache.org/repos/asf/lucene-solr/tree/7ece47ca
Diff: http://git-wip-us.apache.org/repos/asf/lucene-solr/diff/7ece47ca

Branch: refs/heads/master
Commit: 7ece47caf1afc5c6b2589280ec4a6e4a21530210
Parents: f748fc2
Author: Cassandra Targett <ct...@apache.org>
Authored: Thu Oct 26 15:25:05 2017 -0500
Committer: Cassandra Targett <ct...@apache.org>
Committed: Thu Oct 26 15:25:05 2017 -0500

----------------------------------------------------------------------
 solr/solr-ref-guide/build.xml                   |   5 +
 .../src/meta-docs/asciidoc-syntax.adoc          |   8 +
 solr/solr-ref-guide/src/using-solrj.adoc        | 179 +++++++-------
 .../UsingSolrJRefGuideExamplesTest.java         | 235 +++++++++++++++++++
 4 files changed, 347 insertions(+), 80 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7ece47ca/solr/solr-ref-guide/build.xml
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/build.xml b/solr/solr-ref-guide/build.xml
index 6a610b1..1ce3778 100644
--- a/solr/solr-ref-guide/build.xml
+++ b/solr/solr-ref-guide/build.xml
@@ -130,6 +130,11 @@
   <target name="build-init" description="Prepares the build's 'content' dir, copying over src files and transforming *.template files in the process">
     <delete dir="${build.content.dir}" />
     <mkdir dir="${build.content.dir}" />
+
+    <echo>Copying all examples to build directory...</echo>
+    <copy todir="${build.content.dir}">
+      <fileset dir="../solrj/src/test/org/apache/solr/client/ref_guide_examples" />
+    </copy>
     <echo>Copying all non template files from src ...</echo>
     <copy todir="${build.content.dir}">
       <fileset dir="src">

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7ece47ca/solr/solr-ref-guide/src/meta-docs/asciidoc-syntax.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/meta-docs/asciidoc-syntax.adoc b/solr/solr-ref-guide/src/meta-docs/asciidoc-syntax.adoc
index dd9180e..0161225 100644
--- a/solr/solr-ref-guide/src/meta-docs/asciidoc-syntax.adoc
+++ b/solr/solr-ref-guide/src/meta-docs/asciidoc-syntax.adoc
@@ -72,6 +72,14 @@ Pygments has a long selection of lexers available. You can see the full list at
 
 Ideally, we will have an appropriate lexer to use for all source blocks, but that's not possible. When in doubt, choose `text`, or leave it blank.
 
+==== Importing Code Snippets from Other Files
+
+The build system has the ability to "include" code snippets located in other files.
+
+Snippets are bounded by "tag" comments placed at the start and end of the section you would like to import.  Opening tags look like: `// tag::snippetName[]`.  Closing tags follow the format: `// end::snippetName[]`.  Snippets can be dropped into an adoc file using an `include` directive, following a format: `include::PathToFileWithSnippet[tag=snippetName]`.  Note that when relative paths are provided in this directive, that paths are relative to location of the asciidoc file the include appears in.
+
+For more information on the `include` directive, see the documentation http://asciidoctor.org/docs/user-manual/#include-partial[here].
+
 === Block Titles
 
 Titles can be added to most blocks (images, source blocks, tables, etc.) by simply prefacing the title with a period (`.`). For example, to add a title to the source block example above:

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7ece47ca/solr/solr-ref-guide/src/using-solrj.adoc
----------------------------------------------------------------------
diff --git a/solr/solr-ref-guide/src/using-solrj.adoc b/solr/solr-ref-guide/src/using-solrj.adoc
index efdb7cd..5eea5b7 100644
--- a/solr/solr-ref-guide/src/using-solrj.adoc
+++ b/solr/solr-ref-guide/src/using-solrj.adoc
@@ -18,148 +18,167 @@
 // specific language governing permissions and limitations
 // under the License.
 
-{solr-javadocs}/solr-solrj/[SolrJ] is an API that makes it easy for Java applications to talk to Solr. SolrJ hides a lot of the details of connecting to Solr and allows your application to interact with Solr with simple high-level methods.
+{solr-javadocs}/solr-solrj/[SolrJ] is an API that makes it easy for applications written in Java (or any language based on the JVM) to talk to Solr. SolrJ hides a lot of the details of connecting to Solr and allows your application to interact with Solr with simple high-level methods.  SolrJ supports most Solr APIs, and is highly configurable.
 
-The center of SolrJ is the `org.apache.solr.client.solrj` package, which contains just five main classes. Begin by creating a {solr-javadocs}/solr-solrj/org/apache/solr/client/solrj/SolrClient.html[`SolrClient`], which represents the Solr instance you want to use. Then send `SolrRequests` or `SolrQuerys` and get back SolrResponses.
+== Building and Running SolrJ Applications
+
+The SolrJ API ships with Solr, so you do not have to download or install anything else. But you will need to configure your build to include SolrJ and its dependencies.
+
+=== Common Build Systems
 
-`SolrClient` is abstract, so to connect to a remote Solr instance, you'll actually create an instance of either {solr-javadocs}/solr-solrj/org/apache/solr/client/solrj/impl/HttpSolrClient.html[`HttpSolrClient`], or {solr-javadocs}/solr-solrj/org/apache/solr/client/solrj/impl/CloudSolrClient.html[`CloudSolrClient`]. Both communicate with Solr via HTTP, the difference is that `HttpSolrClient` is configured using an explicit Solr URL, while `CloudSolrClient` is configured using the zkHost String for a <<solrcloud.adoc#solrcloud,SolrCloud>> cluster.
+Most mainstream build systems greatly simplify dependency management, making it easy to add SolrJ to your project.
 
+For projects built with Ant (using http://ant.apache.org/ivy/[Ivy]), place the following in your `ivy.xml`:
 
-.Single node Solr client
-[source,java]
+[source,xml]
 ----
-String urlString = "http://localhost:8983/solr/techproducts";
-SolrClient solr = new HttpSolrClient.Builder(urlString).build();
+<dependency org="org.apache.solr" name="solr-solrj" rev="x.y.z"/>
 ----
 
-.SolrCloud client
-[source,java]
-----
-// Using a ZK Host String
-String zkHostString = "zkServerA:2181,zkServerB:2181,zkServerC:2181/solr";
-SolrClient solr = new CloudSolrClient.Builder().withZkHost(zkHostString).build();
+For projects built with Maven, place the following in your `pom.xml`:
 
-// Using already running Solr nodes
-SolrClient solr = new CloudSolrClient.Builder().withSolrUrl("http://localhost:8983/solr").build();
+[source,xml]
+----
+<dependency>
+  <groupId>org.apache.solr</groupId>
+  <artifactId>solr-solrj</artifactId>
+  <version>x.y.z</version>
+</dependency>
 ----
 
-Once you have a `SolrClient`, you can use it by calling methods like `query()`, `add()`, and `commit()`.
+For projects built with Gradle, place the following in your `build.gradle`:
 
-== Building and Running SolrJ Applications
+[source,groovy]
+----
+compile group: 'org.apache.solr', name: 'solr-solrj', version: 'x.y.z'
+----
 
-The SolrJ API is included with Solr, so you do not have to download or install anything else. However, in order to build and run applications that use SolrJ, you have to add some libraries to the classpath.
+=== Adding SolrJ to the Classpath Manually
 
-At build time, the examples presented with this section require `solr-solrj-x.y.z.jar` to be in the classpath.
+If you are not using one of the above build system, it's still easy to add SolrJ to your build.
 
-At run time, the examples in this section require the libraries found in the 'dist/solrj-lib' directory.
+At build time, all that is required is the SolrJ jar itself: `solr-solrj-x.y.z.jar`.  To compile code manually that uses SolrJ, use a `javac` command similar to:
 
-The Ant script bundled with this sections' examples includes the libraries as appropriate when building and running.
+[source,bash]
+----
+javac -cp .:$SOLR_HOME/dist/solr-solrj-x.y.z.jar ...
+----
 
-You can sidestep a lot of the messing around with the JAR files by using Maven instead of Ant. All you will need to do to include SolrJ in your application is to put the following dependency in the project's `pom.xml`:
+At runtime, you need a few of SolrJ's dependencies, in addition to SolrJ itself. For convenience, these dependencies are made available in the `dist/solrj-lib` directory.  Run your project with a classpath like:
 
-[source,xml]
+[source,bash]
 ----
-<dependency>
-  <groupId>org.apache.solr</groupId>
-  <artifactId>solr-solrj</artifactId>
-  <version>x.y.z</version>
-</dependency>
+java -cp .:$SOLR_HOME/dist/solrj-lib/*:$SOLR_HOME/dist/solr-solrj-x.y.z.jar ...
 ----
 
 If you are worried about the SolrJ libraries expanding the size of your client application, you can use a code obfuscator like http://proguard.sourceforge.net/[ProGuard] to remove APIs that you are not using.
 
-== Specifying Solr Base URLs
+== SolrJ Overview
 
-Most `SolrClient` implementations (with the notable exception of `CloudSolrClient`) require users to specify one or more Solr base URLs, which the client then uses to send HTTP requests to Solr.  The path users include on the base URL they provide has an effect on the behavior of the created client from that point on.
+For all its flexibility, SolrJ is built around a few simple interfaces.
 
+<<<<<<< ours
 . A URL with a path pointing to a specific core or collection (e.g., `http://hostname:8983/solr/core1`).  When a core or collection is specified in the base URL, subsequent requests made with that client are not required to re-specify the affected collection.  However, the client is limited to sending requests to  that core/collection, and can not send requests to any others.
 . A URL with a generic path pointing to the root Solr path (e.g., `http://hostname:8983/solr`).  When no core or collection is specified in the base URL, requests can be made to any core/collection, but the affected core/collection must be specified on all requests.
+=======
+All requests to Solr are sent by a {solr-javadocs}/solr-solrj/org/apache/solr/client/solrj/SolrClient.html[`SolrClient`].  SolrClient's are the main workhorses at the core of SolrJ.  They handle the work of connecting to and communicating with Solr, and are where most of the user configuration happens.
+>>>>>>> theirs
 
-== Setting XMLResponseParser
+Requests are sent in the form of {solr-javadocs}/solr-solrj/org/apache/solr/client/solrj/SolrRequest.html[`SolrRequests`], and are returned as {solr-javadocs}/solr-solrj/org/apache/solr/client/solrj/SolrResponse.html[`SolrResponses`].
 
-SolrJ uses a binary format, rather than XML, as its default response format. If you are trying to mix Solr and SolrJ versions where one is version 1.x and the other is 3.x or later, then you MUST use the XML response parser. The binary format changed in 3.x, and the two javabin versions are entirely incompatible. The following code will make this change:
+=== Types of SolrClients
 
-[source,java]
-----
-solr.setParser(new XMLResponseParser());
-----
+`SolrClient` has a few concrete implementations, each geared towards a different usage-pattern or resiliency model:
 
-== Performing Queries
+- {solr-javadocs}/solr-solrj/org/apache/solr/client/solrj/impl/HttpSolrClient.html[`HttpSolrClient`] - geared towards query-centric workloads, though also a good general-purpose client.  Communicates directly with a single Solr node.
+- {solr-javadocs}/solr-solrj/org/apache/solr/client/solrj/impl/LBHttpSolrClient.html[`LBHttpSolrClient`] - balances request load across a list of Solr nodes. Adjusts the list of "in-service" nodes based on node health.
+- {solr-javadocs}/solr-solrj/org/apache/solr/client/solrj/impl/CloudSolrClient.html[`CloudSolrClient`] - geared towards communicating with SolrCloud deployments. Uses already-recorded ZooKeeper state to discover and route requests to healthy Solr nodes.
+- {solr-javadocs}/solr-solrj/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.html[`ConcurrentUpdateSolrClient`] - geared towards indexing-centric workloads.  Buffers documents internally before sending larger batches to Solr.
 
-Use `query()` to have Solr search for results. You have to pass a `SolrQuery` object that describes the query, and you will get back a QueryResponse (from the `org.apache.solr.client.solrj.response` package).
+=== Common Configuration Options
 
-`SolrQuery` has methods that make it easy to add parameters to choose a request handler and send parameters to it. Here is a very simple example that uses the default request handler and sets the query string:
+Most SolrJ configuration happens at the `SolrClient` level.  The most common/important of these are discussed below.  For comprehensive information on how to tweak your `SolrClient`, see the Javadocs for the involved client, and its corresponding builder object.
 
-[source,java]
-----
-SolrQuery query = new SolrQuery();
-query.setQuery(mQueryString);
-----
+==== Base URLs
+Most `SolrClient` implementations (with the notable exception of `CloudSolrClient`) require users to specify one or more Solr base URLs, which the client then uses to send HTTP requests to Solr.  The path users include on the base URL they provide has an effect on the behavior of the created client from that point on.
+
+. A URL with a path pointing to a specific core or collection (e.g. `http://hostname:8983/solr/core1`).  When a core or collection is specified in the base URL, subsequent requests made with that client are not required to re-specify the affected collection.  However, the client is limited to sending requests to  that core/collection, and can not send requests to any others.
+. A URL pointing to the root Solr path (e.g. `http://hostname:8983/solr`).  When no core or collection is specified in the base URL, requests can be made to any core/collection, but the affected core/collection must be specified on all requests.
+
+Generally speaking, if your `SolrClient` will only be used on a single core/collection, including that entity in the path is the most convenient.  Where more flexibility is required, the collection/core should be excluded.
 
-To choose a different request handler, there is a specific method available in SolrJ version 4.0 and later:
+==== Timeouts
+All `SolrClient` implementations allow users to specify the connection and read timeouts for communicating with Solr.  These are provided at client creation time, as in the example below:
 
-[source,java]
+[source,java,indent=0]
 ----
-query.setRequestHandler("/spellCheckCompRH");
+include::UsingSolrJRefGuideExamplesTest.java[tag=solrj-solrclient-timeouts]
 ----
 
-You can also set arbitrary parameters on the query object. The first two code lines below are equivalent to each other, and the third shows how to use an arbitrary parameter `q` to set the query string:
+When these values are not explicitly provided, SolrJ falls back to using the defaults for the OS/environment is running on.
 
-[source,java]
+== Querying in SolrJ
+`SolrClient` has a number of `query()` methods for fetching results from Solr.  Each of these methods takes in a `SolrParams`,an object encapsulating arbitrary query-parameters.  And each method outputs a `QueryResponse`, a wrapper which can be used to access the result documents and other related metadata.
+
+The following snippet uses a SolrClient to query Solr's "techproducts" example collection, and iterate over the results.
+
+[source,java,indent=0]
 ----
-query.set("fl", "category,title,price");
-query.setFields("category", "title", "price");
-query.set("q", "category:books");
+include::UsingSolrJRefGuideExamplesTest.java[tag=solrj-query-with-raw-solrparams]
 ----
 
-Once you have your `SolrQuery` set up, submit it with `query()`:
+`SolrParams` has a `SolrQuery` subclass, which provides some convenience methods that greatly simplifies query creation.  The following snippet shows how the query from the previous example can be built using some of the convenience methods in `SolrQuery`:
 
-[source,java]
+[source,java,indent=0]
 ----
-QueryResponse response = solr.query(query);
+include::UsingSolrJRefGuideExamplesTest.java[tag=solrj-query-with-solrquery]
 ----
 
-The client makes a network connection and sends the query. Solr processes the query, and the response is sent and parsed into a `QueryResponse`.
+== Indexing in SolrJ
+
+Indexing is also simple using SolrJ.  Users build the documents they want to index as instances of `SolrInputDocument`, and provide them as arguments to one of the `add()` methods on `SolrClient`.
 
-The `QueryResponse` is a collection of documents that satisfy the query parameters. You can retrieve the documents directly with `getResults()` and you can call other methods to find out information about highlighting or facets.
+The following example shows how to use SolrJ to add a document to Solr's "techproducts" example collection:
 
-[source,java]
+[source,java,indent=0]
 ----
-SolrDocumentList list = response.getResults();
+include::UsingSolrJRefGuideExamplesTest.java[tag=solrj-index-with-raw-solrinputdoc]
 ----
 
-== Indexing Documents
+CAUTION: The indexing examples above are intended to show syntax.  For brevity, they break several Solr indexing best-practices.  Under normal circumstances, documents should be indexed in larger batches, instead of one at a time.  It is also suggested that Solr administrators commit documents using Solr's autocommit settings, and not using explicit `commit()` invocations.
 
-Other operations are just as simple. To index (add) a document, all you need to do is create a `SolrInputDocument` and pass it along to the `SolrClient` 's `add()` method. This example assumes that the SolrClient object called 'solr' is already created based on the examples shown earlier.
+== Java Object Binding
+While the `UpdateResponse` and `QueryResponse` interfaces that SolrJ provides are useful, it is often more convenient to work with domain-specific objects that can more easily be understood by your application.  Thankfully, SolrJ supports this by implicitly converting documents to and from any class that has been specially marked with {solr-javadocs}/solr-solrj/org/apache/solr/client/solrj//beans/Field.html[`Field`] annotations.
 
-[source,java]
-----
-SolrInputDocument document = new SolrInputDocument();
-document.addField("id", "552199");
-document.addField("name", "Gouda cheese wheel");
-document.addField("price", "49.99");
-UpdateResponse response = solr.add(document);
+Each instance variable in a Java object can be mapped to a corresponding Solr field, using the `Field` annotation.  The Solr field shares the name of the annotated variable by default, however, this can be overridden by providing the annotation with an explicit field name.
 
-// Remember to commit your changes!
+The example snippet below shows an annotated `TechProduct` class that can be used to represent results from Solr's "techproducts" example collection.
 
-solr.commit();
+[source,java,indent=0]
+----
+include::UsingSolrJRefGuideExamplesTest.java[tag=solrj-techproduct-value-type]
 ----
 
-=== Uploading Content in XML or Binary Formats
-
-SolrJ lets you upload content in binary format instead of the default XML format. Use the following code to upload using binary format, which is the same format SolrJ uses to fetch results. If you are trying to mix Solr and SolrJ versions where one is version 1.x and the other is 3.x or later, then you MUST stick with the XML request writer. The binary format changed in 3.x, and the two javabin versions are entirely incompatible.
+Application code with access to the annotated `TechProduct` class above can index `TechProduct` objects directly without any conversion, as in the example snippet below:
 
-[source,java]
+[source,java,indent=0]
 ----
-solr.setRequestWriter(new BinaryRequestWriter());
+include::UsingSolrJRefGuideExamplesTest.java[tag=solrj-index-bean-value-type]
 ----
 
-=== Using the ConcurrentUpdateSolrClient
+Similarly, search results can be converted directly into bean objects using the `getBeans()` method on `QueryResponse`:
 
-When implementing java applications that will be bulk loading a lot of documents at once, {solr-javadocs}/solr-solrj/org/apache/solr/client/solrj/impl/ConcurrentUpdateSolrClient.html[`ConcurrentUpdateSolrClient`] is an alternative to consider instead of using `HttpSolrClient`. The `ConcurrentUpdateSolrClient` buffers all added documents and writes them into open HTTP connections. This class is thread safe. Although any SolrClient request can be made with this implementation, it is only recommended to use the `ConcurrentUpdateSolrClient` for `/update` requests.
+[source,java,indent=0]
+----
+include::UsingSolrJRefGuideExamplesTest.java[tag=solrj-query-bean-value-type]
+----
 
-== EmbeddedSolrServer
+== Other APIs
+SolrJ allows more than just querying and indexing.  It supports all of Solr's APIs.  Accessing Solr's other APIs is as easy as finding the appropriate request object, providing any necessary parameters, and passing it to the `request()` method of your `SolrClient`.  `request()` will return a `NamedList`: a generic object which mirrors the hierarchical structure of the JSON or XML returned by their request.
 
-The {solr-javadocs}/solr-core/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.html[`EmbeddedSolrServer`] class provides an implementation of the `SolrClient` client API talking directly to an micro-instance of Solr running directly in your Java application. This embedded approach is not recommended in most cases and fairly limited in the set of features it supports – in particular it can not be used with <<solrcloud.adoc#solrcloud,SolrCloud>> or <<index-replication.adoc#index-replication,Index Replication>>. `EmbeddedSolrServer` exists primarily to help facilitate testing.
+The example below shows how SolrJ users can call the CLUSTERSTATUS API of SolrCloud deployments, and manipulate the returned `NamedList`:
 
-For information on how to use `EmbeddedSolrServer` please review the SolrJ JUnit tests in the `org.apache.solr.client.solrj.embedded` package of the Solr source release.
+[source,java,indent=0]
+----
+include::UsingSolrJRefGuideExamplesTest.java[tag=solrj-other-apis]
+----

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/7ece47ca/solr/solrj/src/test/org/apache/solr/client/ref_guide_examples/UsingSolrJRefGuideExamplesTest.java
----------------------------------------------------------------------
diff --git a/solr/solrj/src/test/org/apache/solr/client/ref_guide_examples/UsingSolrJRefGuideExamplesTest.java b/solr/solrj/src/test/org/apache/solr/client/ref_guide_examples/UsingSolrJRefGuideExamplesTest.java
new file mode 100644
index 0000000..a988540
--- /dev/null
+++ b/solr/solrj/src/test/org/apache/solr/client/ref_guide_examples/UsingSolrJRefGuideExamplesTest.java
@@ -0,0 +1,235 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *
+ */
+package org.apache.solr.client.ref_guide_examples;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.solr.client.solrj.SolrClient;
+import org.apache.solr.client.solrj.SolrQuery;
+import org.apache.solr.client.solrj.SolrRequest;
+import org.apache.solr.client.solrj.beans.Field;
+import org.apache.solr.client.solrj.impl.HttpSolrClient;
+import org.apache.solr.client.solrj.request.CollectionAdminRequest;
+import org.apache.solr.client.solrj.response.CollectionAdminResponse;
+import org.apache.solr.client.solrj.response.QueryResponse;
+import org.apache.solr.client.solrj.response.UpdateResponse;
+import org.apache.solr.cloud.SolrCloudTestCase;
+import org.apache.solr.common.SolrDocument;
+import org.apache.solr.common.SolrDocumentList;
+import org.apache.solr.common.SolrInputDocument;
+import org.apache.solr.common.params.MapSolrParams;
+import org.apache.solr.common.util.NamedList;
+import org.apache.solr.util.ExternalPaths;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+/**
+ * Example SolrJ usage.
+ *
+ * Snippets surrounded by "tag" and "end" comments are extracted and used in the Solr Reference Guide.
+ */
+public class UsingSolrJRefGuideExamplesTest extends SolrCloudTestCase {
+
+  private static final int NUM_INDEXED_DOCUMENTS = 3;
+  private static final int NUM_LIVE_NODES = 1;
+
+  @BeforeClass
+  public static void setUpCluster() throws Exception {
+    configureCluster(NUM_LIVE_NODES)
+        .addConfig("conf", new File(ExternalPaths.TECHPRODUCTS_CONFIGSET).toPath())
+        .configure();
+
+    CollectionAdminResponse response = CollectionAdminRequest.createCollection("techproducts", "conf", 1, 1)
+        .process(cluster.getSolrClient());
+  }
+
+  @Before
+  @Override
+  public void setUp() throws Exception {
+    super.setUp();
+    final SolrClient client = getSolrClient();
+
+    final List<TechProduct> products = new ArrayList<TechProduct>();
+    products.add(new TechProduct("1","Fitbit Alta"));
+    products.add(new TechProduct("2", "Sony Walkman"));
+    products.add(new TechProduct("3", "Garmin GPS"));
+
+    client.addBeans("techproducts", products);
+    client.commit("techproducts");
+  }
+
+  @After
+  @Override
+  public void tearDown() throws Exception {
+    super.tearDown();
+
+    final SolrClient client = getSolrClient();
+    client.deleteByQuery("techproducts", "*:*");
+    client.commit("techproducts");
+  }
+
+  @Test
+  public void queryWithRawSolrParamsExample() throws Exception {
+    // tag::solrj-query-with-raw-solrparams[]
+    final SolrClient client = getSolrClient();
+
+    final Map<String, String> queryParamMap = new HashMap<String, String>();
+    queryParamMap.put("q", "*:*");
+    queryParamMap.put("fl", "id, name");
+    MapSolrParams queryParams = new MapSolrParams(queryParamMap);
+
+    final QueryResponse response = client.query("techproducts", queryParams);
+    final SolrDocumentList documents = response.getResults();
+
+    assertEquals(NUM_INDEXED_DOCUMENTS, documents.getNumFound());
+    for(SolrDocument document : documents) {
+      assertTrue(document.getFieldNames().contains("id"));
+      assertTrue(document.getFieldNames().contains("name"));
+    }
+    // end::solrj-query-with-raw-solrparams[]
+  }
+
+  @Test
+  public void queryWithSolrQueryExample() throws Exception {
+    final int numResultsToReturn = 1;
+    final SolrClient client = getSolrClient();
+
+    // tag::solrj-query-with-solrquery[]
+    final SolrQuery query = new SolrQuery("*:*");
+    query.addField("id");
+    query.addField("name");
+    query.setRows(numResultsToReturn);
+    // end::solrj-query-with-solrquery[]
+
+    final QueryResponse response = client.query("techproducts", query);
+    final SolrDocumentList documents = response.getResults();
+
+    assertEquals(NUM_INDEXED_DOCUMENTS, documents.getNumFound());
+    assertEquals(numResultsToReturn, documents.size());
+    for(SolrDocument document : documents) {
+      assertTrue(document.getFieldNames().contains("id"));
+      assertTrue(document.getFieldNames().contains("name"));
+    }
+  }
+
+  @Test
+  public void indexWithSolrInputDocumentExample() throws Exception {
+    // tag::solrj-index-with-raw-solrinputdoc[]
+    final SolrClient client = getSolrClient();
+
+    final SolrInputDocument doc = new SolrInputDocument();
+    doc.addField("id", UUID.randomUUID().toString());
+    doc.addField("name", "Amazon Kindle Paperwhite");
+
+    final UpdateResponse updateResponse = client.add("techproducts", doc);
+    // Indexed documents must be committed
+    client.commit("techproducts");
+    // end::solrj-index-with-raw-solrinputdoc[]
+
+    assertNumDocuments(NUM_INDEXED_DOCUMENTS + 1);
+  }
+
+  @Test
+  public void indexBeanValueTypeExample() throws Exception {
+    // tag::solrj-index-bean-value-type[]
+    final SolrClient client = getSolrClient();
+
+    final TechProduct kindle = new TechProduct("kindle-id-4", "Amazon Kindle Paperwhite");
+    final UpdateResponse response = client.addBean("techproducts", kindle);
+
+    client.commit("techproducts");
+    // end::solrj-index-bean-value-type[]
+
+    assertNumDocuments(NUM_INDEXED_DOCUMENTS + 1);
+  }
+
+  @Test
+  public void queryBeanValueTypeExample() throws Exception {
+    // tag::solrj-query-bean-value-type[]
+    final SolrClient client = getSolrClient();
+
+    final SolrQuery query = new SolrQuery("*:*");
+    query.addField("id");
+    query.addField("name");
+
+    final QueryResponse response = client.query("techproducts", query);
+    final List<TechProduct> products = response.getBeans(TechProduct.class);
+    // end::solrj-query-bean-value-type[]
+
+    assertEquals(NUM_INDEXED_DOCUMENTS, products.size());
+    for (TechProduct product : products) {
+      assertFalse(product.id.isEmpty());
+      assertFalse(product.name.isEmpty());
+    }
+  }
+
+  @Test
+  public void otherSolrApisExample() throws Exception {
+    // tag::solrj-other-apis[]
+    final SolrClient client = getSolrClient();
+
+    final SolrRequest request = new CollectionAdminRequest.ClusterStatus();
+
+    final NamedList<Object> response = client.request(request);
+    final NamedList<Object> cluster = (NamedList<Object>) response.get("cluster");
+    final List<String> liveNodes = (List<String>) cluster.get("live_nodes");
+
+    assertEquals(NUM_LIVE_NODES, liveNodes.size());
+    // end::solrj-other-apis[]
+  }
+
+  private SolrClient getSolrClient() {
+    return cluster.getSolrClient();
+  }
+
+  private SolrClient getTechProductSolrClient() {
+    // tag::solrj-solrclient-timeouts[]
+    final String solrUrl = "http://localhost:8983/solr";
+    return new HttpSolrClient.Builder(solrUrl)
+        .withConnectionTimeout(10000)
+        .withSocketTimeout(60000)
+        .build();
+    // end::solrj-solrclient-timeouts[]
+  }
+
+  private void assertNumDocuments(int expectedNumResults) throws Exception {
+    final QueryResponse queryResponse = getSolrClient().query("techproducts", new SolrQuery("*:*"));
+    assertEquals(expectedNumResults, queryResponse.getResults().getNumFound());
+  }
+
+  // tag::solrj-techproduct-value-type[]
+  public static class TechProduct {
+    @Field public String id;
+    @Field public String name;
+
+    public TechProduct(String id, String name) {
+      this.id = id;  this.name = name;
+    }
+
+    public TechProduct() {}
+  }
+  // end::solrj-techproduct-value-type[]
+
+}